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

Re: Selecting node sets for page by page output - without us

Subject: Re: Selecting node sets for page by page output - without usingfor-each or mutiple ifs
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Wed, 30 Aug 2000 09:39:18 +0100
xsl select without any attributes
Aaron,

>then i use a variable and a single <xsl:if> to check for the presence of a
>topic name:
>
>      <xsl:variable name="pos"><xsl:number/></xsl:variable>
>      <xsl:if test="number($pos)=1">
>          <xsl:apply-templates select="../../topic"/>
>      </xsl:if>

xsl:number without any attributes will give you the number of the node
within the list of it's similar siblings - in your case the number of the
story amongst the other story elements within the storyList.  So generating
that number and checking whether it's '1' or not is equivalent to asking
the question 'is this the first story element under its storyList' or 'are
there any preceding story elements to this one in the source?'.

So, you could change your test to the slightly less ugly:

<xsl:if test="not(preceding-sibling::story)">
  <xsl:apply-templates select="../../topic" />
</xsl:if>

Cheers,

Jeni



 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.