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 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Selecting node sets for page by, Aaron Miller | Thread | Internal design documentation tools, Mike Van Riper |
Re: running a for loop (eg.1 to 10), Oliver Becker | Date | Re: running a for loop (eg.1 to 10), Miloslav Nic |
Month |