[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: first of type element position

Subject: Re: first of type element position
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Tue, 12 Mar 2002 10:18:00 +0000
xsl first of type
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.