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
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--