|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] can't conditionally format first occurence of a node
Dear list, I need to add "<br />" before the first occurance of a node "<sense>". What I would like to work is this: <xsl:template match="sense"> <xsl:if test="position()=1"> <br /> </xsl:if> <div><xsl:apply-templates /></div> </xsl:template> but as I've now discovered position() doesn't mean the first <sense> node here like it does if it were a <xsl:for-each...> loop. I don't think I can use a <xsl:for-each...> because outside of the <sense> nodes the structure is very free form--i.e. I need to "push process" rather than "pull process". I also tried using a global variable which I would want to change after the first <sense> node: <xsl:variable name="first" select="1" /> <xsl:template match="sense"> <xsl:if test"$first=1"> <br /> <xsl:variable name="first" select="0" /> </xsl:if> <div><xsl:apply-templates /></div> </template> but this just creates a local $first variable which won't be used for the next <sense> node. Is there another way to change the value of $first after the first time it is used? Any ideas. Thanks, Jeremy
|
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








