Subject: [xsl] can't conditionally format first occurence of a node From: jeremy <jeremy_march@xxxxxxxxxxx> Date: Sat, 25 Jun 2005 19:22:42 -0400 |
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
Current Thread |
---|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] TeX to MathML by using XS, David Carlisle | Thread | RE: [xsl] can't conditionally forma, Aron Bock |
Re: [xsl] Trouble removing dup elem, Sam D. Chuparkoff | Date | RE: [xsl] can't conditionally forma, jeremy |
Month |