[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Dynamic numbering of lists in xslt

Subject: Re: Dynamic numbering of lists in xslt
From: xslt.new <xslt.new@xxxxxxxxx>
Date: Wed, 10 Jan 2007 16:01:00 -0600
Re:  Dynamic numbering of lists in xslt
This does not seem to work for some reason if the <travel1> tag
without the condition is inbetween the other tags like this:

<travel1>
<location
<place>NY<place>
<time>EST</time>
</location>
  <travel2>
<location
<place>CaL<place>
<time>PST</time>
</location>
</travel2>
</travel1>

<travel1>
<location
<place>Chi<place>
<time>CST</time>
</location>
</travel1>

<travel1>
<text>Some text</text>
</travel1>

<travel1>
<location
<place>NY<place>
<time>EST</time>

</location>
</travel1>

<xsl:template match="travel1">

<xsl:choose>

<xsl:when test=".//location">
<xsl:if test=".//location/place=$place and .//location/time=$time">
<fo:list-block space-before="6pt" space-before.conditionality="retain">
     <fo:list-item>
             <fo:list-item-label end-indent="label-end()">
                     <fo:block>
               <xsl:number from="/"
count="travel1[location/time=$time and location/place=$place]"
format="1"/>
                     </fo:block>
             </fo:list-item-label>
             <fo:list-item-body start-indent="body-start()" end-indent="0pt">
                     <fo:block>
                             <xsl:apply-templates/>
                     </fo:block>
             </fo:list-item-body>
     </fo:list-item>
</fo:list-block>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<fo:list-block space-before="6pt" space-before.conditionality="retain">
     <fo:list-item>
             <fo:list-item-label end-indent="label-end()">
                     <fo:block>
               <xsl:number from="/" count="travel1[not(.//location)
or .//location/time=$time and .//location/place=$place] format="1"/>
                     </fo:block>
             </fo:list-item-label>
             <fo:list-item-body start-indent="body-start()" end-indent="0pt">
                     <fo:block>
                             <xsl:apply-templates/>
                     </fo:block>
             </fo:list-item-body>
     </fo:list-item>
</fo:list-block>

</xsl:otherwise>
</xsl:choose>
</xsl:template>

Now I get:

1. NY, EST
1. Some text
2. NY, EST

Why does the counter get reset for the <travel1> without the conditions?



On 1/10/07, David Carlisle <davidc@xxxxxxxxx> wrote:
> ok I think i spoke too fast. I forogot another condition. What if

just write your condition in xpath rather than english

count="travel1[
   not(location)
    or
    location/time=$time and location/place=$place]"/>

David

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.