This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Selecting node sets for page by page output - without usingfor-each or mutiple ifs
- To: Aaron Miller <amiller at zatso dot com>
- Subject: Re: Selecting node sets for page by page output - without usingfor-each or mutiple ifs
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Wed, 30 Aug 2000 09:39:18 +0100
- Cc: <xsl-list at mulberrytech dot com>
- References: <B5D15878.60F7%amiller@zatso.com>
- Reply-To: xsl-list at mulberrytech dot com
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