X4 Produktdokumentation

context:-URL-Protokoll

With the context: URL protocoll, you can access variables in XSL mappings that have been defined using the variable element and placed before the XSL mapping element in the process at runtime of a process. The document stored in the variable can be integrated in the XSL mapping via the document() function.

Note:

When processed in the process, the document() function does not return an error message if access to the variable fails, for example, due to a typing error or because the variable was not created with the PUT option.

image-20260312-131148.png


Structure of the URL

The URL should be structured according to the following pattern (slashes after the URL handler may be problematic):

context:Variablenname 


An XSL mapping using this URL protocol cannot be executed in the transformation preview of the Mapping Editor.

Example

In this example, the variable Var was created via a Variable process component in a process that also contains the following XSL mapping. This variable stores an XML document that is read in the XSL mapping via the document() function and cached in a DocVar XSL variable. Their nodes can be selected as desired via XPath.

<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>