Subject: [xsl] Global variable in included stylesheet From: "Andrey Astakhov" <paranorm@xxxxxxxxx> Date: Thu, 21 Feb 2002 10:02:55 +0300 (MSK) |
Hello! I have xml file (global.xml) and two xsl files (1.xsl, 2.xsl). File global.xml is transformed with the stylesheet 1.xsl. File 2.xsl is included in 1.xsl. This files here: File global.xml <?xml version="1.0"?> <global-settings> <supporting-languages> <language ID="En" caption="English"/> <language ID="De" caption="German"/> </supporting-languages> <parameter name="DefaultLanguageID" value="En"/> <parameter name="DefaultMenuItemID" value="miCommonInformation"/> </global-settings> -------------------------------------------------- File 1.xsl <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:include href="2.xsl"/> <xsl:variable name="DefaultLanguageID"/> <xsl:template match="global-settings"> <xsl:variable name="DefaultLanguageID" select="parameter[@name='DefaultLanguageID']/@value"/> <!-- Display variable value in 1.xsl --> <hr/> [1.xsl]: <xsl:value-of select="$DefaultLanguageID"/> <hr/> <xsl:apply-templates select="parameter"/> </xsl:template> </xsl:stylesheet> ----------------------------------------------------- File 2.xsl <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="parameter"> It is the parameter <!-- Display variable value in 2.xsl --> [2.xsl]: <xsl:value-of select="$DefaultLanguageID"/> <br/> </xsl:template> </xsl:stylesheet> ---------------------------------------------------- After the transforming i see: ----------------- [1.xsl]: En ----------------- It is the parameter [2.xsl]: It is the parameter [2.xsl]: The problem - i cann't get the value of global variable $DefaultLanguageID in included stylesheet 2.xsl. I thought all global variables must be available anywhere. Is it wrong? How can i obtain $DefaultLanguageID in 2.xsl? ...and sorry for my poor English... Best regards, Andrey XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSL output problem, Jeni Tennison | Thread | Re: [xsl] Global variable in includ, Joerg Heinicke |
Re: [xsl] A general question (Mozil, Edward . Middleton | Date | Re: [xsl] HTML tag inside <xsl:when, Matts Isuls |
Month |