Page 1 of 1

xsl:include question / error messages

Posted: Fri Jan 04, 2008 2:25 pm
by walterbt
Hi,

I often works with xsl:includes.

When I edit an xsl file which is included in another xsl I always get an error that some templates or variables are missing because these are defined in another xsl.

How can I solve this problem?

Example:
file nl.xsl

Code: Select all


<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="ISO-8859-1"/>
<xsl:variable name="template_name">B2C</xsl:variable>
<xsl:include href="test.xsl" />
<xsl:template name="inculde_test"/>
</xsl:stylesheet>
file test.xsl

Code: Select all


<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="ISO-8859-1"/>
<xsl:template match="\">
<xsl:value-of select="$template_name"/>
<xsl:call-template name="include_test"/>
</xsl:template>
</xsl:stylesheet>
</xsl:stylesheet>
I get an error in test.xsl the variable "template_name" and template "include_test" isn't declared. I am using Xalan XSLT Processor and oXygenXML 9.1

Thx walter

Posted: Fri Jan 04, 2008 3:04 pm
by sorin_ristache
Hello,

This is a perfect application for oXygen's notion of validation scenario. Just define a validation scenario in which the base unit is nl.xsl and associate this scenario with test.xsl. Both manual validation and automatic validation will apply this scenario instead of simply validating test.xsl as a standalone stylesheet.


Regards,
Sorin