|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: value of variable inside a condition doesn't work?
> -----Original Message----- > From: "Hubert Holtz" <Turnhose_alt@xxxxxxx> > > <xsl:if test="($lang)='1' "> > <xsl:variable name="stadt" select="Stadt"/> > <xsl:variable name="Texteingabe" select="Hier Text eingeben"/> > <xsl:variable name="berichtstatus" select="aktuell"/> > </xsl:if> > > <xsl:if test="($lang)='2' "> > <xsl:variable name="stadt" select="city"/> > <xsl:variable name="Texteingabe" select="Please enter text"/> > <xsl:variable name="berichtstatus" select="current"/> > </xsl:if> > > .. > > <td><xsl:value-of select="$stadt"/></td> > > -- code -- You have two problems: 1) When you assign a literal string to a variable, you must doubly quote the string, thus: <xsl:variable name="stadt" select="'city'"/> not as you have done: <xsl:variable name="stadt" select="city"/> 2) A variable exists only within the scope where it was defined. Once you exit that scope (in your example, once the transformation exits the <xsl:if> element) the variable ceases to exist. You have two choices here: 2a) Put all the relevant templates and elements inside each <xsl:if> element. 2b) Define the templates once and invoke them inside each <xsl:if> by using <xsl:apply-templates> or <xsl:call-template>. -- Charles Knell cknell@xxxxxxxxxx - email XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








