|
Subject: Re: [xsl] first of type element position From: "Sébastien Tisserant" <stisserant@xxxxxxxxxxxxxxx> Date: Tue, 12 Mar 2002 11:42:59 +0100 |
thanks jeni,
your propositions work.
but is it possible with indicating the position and the element name in the test
like this:
<xsl:if test=".[self::TOC.SECT][position()!=1]">
i have already use *[self::TOC.SECT][1] (with the same kind of problem) in a template match and it worked well.
thanks again for your always detailed and rich explanations.
Sébastien
>>> Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> 03/12/02 11:18 >>>
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 -> |
|---|---|---|
| RE: [xsl] first of type element pos, Michael Kay | Thread | Re: [xsl] first of type element pos, Jeni Tennison |
| RE: [xsl] first of type element pos, Michael Kay | Date | [xsl] max value of an element, Ilyasov Jienbay |
| Month |