Subject: Re: [xsl] first of type element position From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Tue, 12 Mar 2002 10:18:00 +0000 |
Hi Sébastien, > <xsl:if test="position()!=1"> doesn't work because, i think, the > first element <TOC.SECT> is in position()=2. and <TI.TOC> in > position()=1. You can test whether the TOC.SECT has a preceding sibling TOC.SECT element: <xsl:if test="preceding-sibling::TOC.SECT"> <!-- not the first TOC.SECT element --> ... </xsl:if> Or you could change the way that you apply templates to the elements, so that the position() test would work. If you did: <xsl:template match="RP.TOC"> ... <xsl:apply-templates select="TI.TOC" /> <xsl:apply-templates select="TOC.SECT" /> ... </xsl:template> Then in the template matching the TOC.SECT elements, the set of nodes to which you were applying templates would only contain TOC.SECT elements, and the node in position 1 would be the first of those TOC.SECT elements. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] first of type element positio, Sébastien Tisserant | Thread | Re: [xsl] first of type element pos, Peter Davis |
RE: [xsl] avoiding repetition - mor, stevenson | Date | [xsl] avoiding Repetition - further, stevenson |
Month |