Subject: [xsl] variable binding From: Shipra Dingare <sdingar1@xxxxxxxxxxxx> Date: Wed, 5 Nov 2003 22:06:31 +0000 (GMT) |
I'm having trouble with variable binding - basically, I read that variable bindings declared in templates should be visible to descendants and following siblings, but I'm getting not getting the behavior I thought I would with my stylesheet using Saxon 6.5.2... so the relevant part of my file looks like this (it's a subbranch of s): <ng of='proteins' role='h'> <nx head='targeting' role='h'> <W index='92'>the</W> <W role='h' index='93'>targeting</W> </nx> <W index='94'>of</W> <nx head='proteins' role='k'> <W index='95'>the</W> <W index='96'>myosin</W> <W role='h' index='97'>proteins</W> </nx> </ng> and my stylesheet looks like this: <xsl:template match="@* | * | comment() | processing-instruction() | node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="s//ng//*[1]" priority="5"> <xsl:variable name="branch">right</xsl:variable> <xsl:copy> <xsl:attribute name="branch"><xsl:value-of select="$branch"/></xsl:attribute> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="s//ng//*" priority="4"> <xsl:copy> <xsl:attribute name="branch"><xsl:value-of select="$branch"/></xsl:attribute> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> but when I try to run it, it tells me that the variable branch has not been declared, even though it should first have processed the first daughter of ng, where it has been declared. Best, shipra XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] grouping for-each, james walker | Thread | [xsl] Re: variable binding, Sam Byland |
Re: [xsl] XML element to Javascript, Nik Coughlin | Date | [xsl] [ANN]: Two announcements on A, Eric Promislow |
Month |