I am triggering the transformation using a .NET code,
unless I add "EnableDocumentFunction" property to the XSL-Setting, the program throws error saying .. "Usage of Document() function is prohibited",
Actually the program is not editable and a kind of read-only .. is it possible to edit the XSL code itself so that I can use document() function??
The sample XSL and XMLs are Here:
Sample XML :
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:variable name="State_Code_Trn">
<State In="California" Out="CA"/>
<State In="CA" Out="CA"/>
<State In="Texas" Out="TX"/>
<State In="TX" Out="TX"/>
</xsl:variable>
<xsl:template name="testing" match="test_node">
<xsl:variable name="test_val">
<xsl:value-of select="."/>
</xsl:variable>
<xsl:element name="{name()}">
<xsl:choose>
<xsl:when test="document('')/*/xsl:variable[@name='State_Code_Trn']
/State[@In=$test_val]">
<xsl:value-of select="document('')/*/xsl:variable[@name='State_Code_Trn']
/State[@In=$test_val]/@Out"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>Other</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
And the sample XML :
<?xml version="1.0" encoding="utf-8"?>
<root>
<test_node>California</test_node>
<test_node>CA</test_node>
<test_node> CA</test_node>
<test_node>Texas</test_node>
<test_node>TX</test_node>
<test_node>CAA</test_node>
<test_node></test_node>
</root>