context: URL Protocol
The context:
URL protocol enables you to access variables from XSL mappings during the runtime of an X4 process. This variables can be defined within the process with a Variable
component and must be placed in a process before the XSL mapping component. The document stored in a context variable can be retrieved from the XSL mapping using the document()
function.
URL Structure
The URL must follow the pattern (slashes after the URL handler may cause problems):
context:VariableName
An XSL mapping using this URL protocol cannot be executed in the transformation preview oft the Mapping Editor.
Example
A sample process containing the following XSL mapping provides a variable Var
that has been defined using a Variable
component. This variable stores an XML document that will be retrieved from the XSL mapping using the document()
function, and will be buffered in an XSL variable DocVar
. Its nodes can be selected via XPath without limitation.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output encoding="UTF-8" method="xml" version="1.0"/>
<xsl:template match="/">
<result>
<xsl:variable select="document('context:Var')" name="DocVar"/>
<xsl:value-of select="$DocVar/child::ElemName"/>
</result>
</xsl:template>
</xsl:stylesheet>