| Subject: Re: [xsl] Counting nodes processed From: "Joerg Heinicke" <joerg.heinicke@xxxxxx> Date: Tue, 5 Mar 2002 20:11:25 +0100 | 
<xsl:template match="TopicOwner">
    <xsl:apply-templates select="Category"/>
</xsl:template>
<xsl:template match="Category">
    <xsl:value-of select="@name"/>
    <xsl:apply-templates
select="Topic[count(../preceding-sibling::Category/Topic) < 5]"/>
</xsl:template>
<xsl:template match="Topic">
    <xsl:value-of select="@name"/>
</xsl:template>
Regards,
Joerg
> All,
>
> thanks for the help yesterday.  However, as I was working on this problem
I realized that my xml description was slightly different.  There's a new
twist.  The xml description is now similar to the following:
>
> <Root>
>   <TopicOwner id="1" name="owner1">
>      <Category id ="1" name="Sports">
>         <Topic id="1" name="Basketball"/>
>         <Topic id="2" name="Football"/>
>         <Topic id="3" name="Baseball"/>
>      </Category>
>      <Category id="2" name="FooCategory">
>         <Topic id="4" name="FooTopic"/>
>      </Category>
>   </TopicOwner>
>   <TopicOwner id="2" name="owner2">
>     <Category id="2" name="Entertainment">
>         <Topic id="4" name="Puzzles"/>
>         <Topic id="5" name="Games"/>
>     </Category>
>   </TopicOwner>
> </Root>
>
> Each owner may have > 1 category and each category has > 1 topic.  The
problem is still the same.  I want to retrieve only X number of topics for
each owner.  So, assuming I want to retrieve 4 topics per owner, the output
should be
>
> Owner1
>   Sports
>      Basketball
>      Football
>      Baseball
>   FooCategory
>      FooTopic
>
> Owner2
>   Entertainment
>      Puzzles
>      Games
>
> Thanks,
> jay
 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
| Current Thread | 
|---|
| 
 | 
| <- Previous | Index | Next -> | 
|---|---|---|
| RE: [xsl] Counting nodes processed, JAY SCHERER | Thread | RE: [xsl] Counting nodes processed, JAY SCHERER | 
| Re: [xsl] NEWLINES, cutlass | Date | Re: [xsl] NEWLINES, Wendell Piez | 
| Month |