[xsl] Re: Re: Node Selection List

Subject: [xsl] Re: Re: Node Selection List
From: tsterlin@xxxxxxxxxxxxxxxxx
Date: Sat, 21 Feb 2004 12:02:55 -0700
I implemented your techniques so now I have:

<(when this item node's parent's title != 'Raging River')>
  <xsl:value-of select="1+count(preceding-sibling::ITEM)+count(../preceding-    
                   sibling::PARA0[TITLE!='Raging River']/ITEM)"/>
  <xsl:text>.  </xsl:text>
</end when>

However every ITEM is getting numbered with a "1." which means the values being
returned by both count functions are zero.  Is it because I do not have a loop
of any kind, and everytime the count functions are called it cannot "retro"
count the previous ITEM's which fit this description?  I know a loop would be a
convenient method, but unfortunately my ITEM's are contained within different
parent elements and so the for loop does not work without disturbing alot of
other tag's linear placement within the XML document.  Is there any way to get
the stylesheet to "remember" all of the ITEM tags that fit this description

> Date: Fri, 20 Feb 2004 15:58:40 -0700
> From: tsterlin@xxxxxxxxxxxxxxxxx
> Subject: [xsl] Node selection list
> Josh, maybe this will better clarify my problem
> Here is the XSLT code I have now:
>   <xsl:template match="ITEM">
>     <xsl:choose>
>       <xsl:when test="string(ancestor::PARA0/TITLE)='Raging River '">
>         <p class="bulletPara"><xsl:apply-templates/></p>
>       </xsl:when>
>       <xsl:when test="not(string(ancestor::PARA0/TITLE)='Raging River ')">
>         <xsl:value-of select="count(ITEM)"/>
>         <p class="numberedPara"><xsl:apply-templates/></p>
>       </xsl:when>
>     </xsl:choose>
>   </xsl:template>
> I know my test statement works because I get numbers for the items I want and
> bullet points for the other items.  However, the numbered items all have
> zeroes
> for their numbers.  I've also tried the number funtion, but I cannot set the
> number attribute "count" or "from" with the condition
> "not(string(ancestor::PARA0/TITLE)='Raging River ')" and must use a tag that
> encompasses too much or too little.  I have other ITEMS earlier in the
> document
> and the ones I want are broken into separate tags.  So I wind up with either
> a
> continuous count starting at 14(there are 13 ITEMS prior to these) or a
> broken
> count(one set of 1-3, another of 1-7 and so on).  Do you know of a
> function/command I can use within this test to sequentially accumulate all of
> the ITEMS that pass this test?  I cannot seem to get position, count, or
> number
> to work for me.
> Thanks,
> Tracy.

> ------------------------------
> Date: Fri, 20 Feb 2004 23:49:02 GMT
> From: David Carlisle <davidc@xxxxxxxxx>
> Subject: Re: [xsl] Node selection list
>   <xsl:template match="ITEM">
> so here the current node is ITEM
>         <xsl:value-of select="count(ITEM)"/>
> and here you are counting the number of child elements called ITEM which
> is zero.
> You probably want xsl:number
> or 1 +count( preceding-sibling::ITEM)
> or
> River']/ITEM)
> , but I cannot set the
> number attribute "count" or "from" with the condition
> "not(string(ancestor::PARA0/TITLE)='Raging River ')"
> you don't want to number a condition you want to number elements on
> which that condition is true so use  ITEM[not(......)]
> also if you know PARA0 is teh parent of ITEM, use parent:: rather than
> ancestio:: it's a lot kinder to th esystem.
> - --

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread