Subject: RE: [xsl] Defining a variable for configuration file From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Thu, 13 Oct 2005 23:40:42 +0100 |
The variable is only in scope for its own following-siblings and their descendants. Try something like: <xsl:variable name="Config" select="document('1011CustomerConfig.xml')[$root//storerkey = '1011']"/> where $root is the principal input document Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: Challa, Harsha [mailto:hchalla@xxxxxxxxxxxx] > Sent: 13 October 2005 20:00 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] Defining a variable for configuration file > > Hi > > Could someone help me with this. I am defining the variable > in a template > but looks like the $Config is not being recognized. > I am getting error 'XSL transformation failed due to following error: > Invalid variable referenceErrror in XPath expression, invalid variable > reference" > > thanks > Harsha > > > > <xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > > <xsl:output method="xml" version="1.0" encoding="UTF-8" > indent="yes" > doctype-system="urn:/ShipmentOrderCreate.dtd"/> > > > <xsl:template match="/"> > > > <xsl:if test="//storerkey = '1011'"> > > <xsl:variable name="Config" select= > "document('1011CustomerConfig.xml')"/> > > </xsl:if> > > > <xsl:element name="ShipmentOrderCreate"> > > <xsl:element > name="CustomerCode"><xsl:value-of > select="$Config/ConfigurationFile/CustomerCode"> > </xsl:value-of> </xsl:element> > > </xsl:element> > > </xsl:template>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Defining a variable for c, Jon Gorman | Thread | [xsl] Trying to find out which XSLT, G. Ken Holman |
Re: [xsl] Trying to find out which , David Carlisle | Date | RE: [xsl] How to Tag Several Words , UlyLee |
Month |