This function takes the URI of a stylesheet and an XML entity and produces an XML entity representing the transformation result of the given entity with the given stylesheet. The result tree is separate from the argument tree and the only reference to it is the returned entity. Errors occurring in the transformation will be signalled as SQL states, with XML or XSLT specific conditions beginning with XS or XP.
The stylesheet is applied to the value of source parameter. Obviously, source must be an entity. If source is not specified then the stylesheet is applied to the current entity.
Parameters can be passed to the stylesheet by specifying additional arguments to processXSLT(). The values can be referenced from inside XPath expressions in the stylesheet. The names of parameters should appear in argument list without the leading '$' sign. Unlike xslt() function, parameter can not be ignored depending on the type of its value. If the same name appears more than once in the vector, the last name/value pair is used and all preceding pairs with this name are silently ignored. Obviously, names should be strings that are valid XPath variable names.
The function uses the cache of compiled stylesheets, see description of xslt() Virtuoso/PL function for more details.
For compatibility, the processXSLT() function can also be called as http://schemas.oracle.com/xpath/extension:processXSLT().
The function returns an XML entity that is the root entity of the resulting document of an XSL transformation.
The query composes a single document that contain a list of labels for parcels. Depending on destination country and the state value of the parcel, the query applies one of three stylesheets that make a label from the address data; the query makes a label from every item of sequence $orders.
<parcel-labels> for $order in $orders let $customer := $customers/customer [ @CustId = $order/@CustId ] return if ($customer/address/@Country = "US") if ($order/sum >= 50.0) processXSLT ("file://registered-parcel.xsl", $customer/address, "value", $order/sum) else processXSLT ("file://plain-parcel.xsl", $customer/address) else processXSLT ("file://foreign-parcel.xsl", $customer/address, "value", $order/sum) </parcel-labels>