Subject: Re: [xsl] counting with position() From: "Imsieke, Gerrit, le-tex" <gerrit.imsieke@xxxxxxxxx> Date: Tue, 05 Jan 2010 22:34:40 +0100 |
I'm trying to guess what you want to achieve from this inner code. > <xsl:variable name="count" > select="count(./following-sibling::product[position()!=last()])"/> > <xsl:if test="$count>= 1"> > <xsl:apply-templates > select="./following-sibling::product[position() < $count]"/> > </xsl:if>
<xsl:template match="level2/product[ preceding-sibling::item and (: All products before this one but after the immediately precedent item must also be products:) ( every $p in preceding-sibling::*[ . >> preceding-sibling::item[1] ] satisfies $p/self::product ) and (: All following siblings before level3 must also be products. If there's no level3 then the every expression evals to true() :) ( every $f in following-sibling::*[ . << following-sibling::level3[1] ] satisfies $f/self::product ) ][ (: Restrict the result so far to all but the last two items - don't know if this is really what you want:) position() lt last() - 1 ] "> <!-- Really only apply, not copy? --> <xsl:apply-templates /> </xsl:template>
<!-- Discard all other products: --> <xsl:template match="level2/product" priority="0"/>
<!-- Everything else: identity --> <xsl:template match="@* | *" priority="-1"> <xsl:copy> <xsl:apply-templates select="@* | * | text()" mode="#current" /> </xsl:copy> </xsl:template>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] counting with position(), Syd Bauman | Thread | Re: [xsl] counting with position(), a kusa |
Re: [xsl] Modern web site design wi, Eric J. Bowman | Date | Re: [xsl] Modern web site design wi, David Carlisle |
Month |