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

Re: recursive counter not incrementing

Subject: Re: recursive counter not incrementing
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 8 Dec 2004 22:41:37 GMT
recursion counter
It's not clear why you are using recursion rather than just using
postion() or count to get this number, but perhaps that's just because
you have cut the example down, I didn't follow all the logic of your
stylesheet but can comment on some lines:

               <xsl:with-param name="s1"
               select="$s1/item[following-sibling]"/>

That selects all items that have a child called following-sibling so it
will be empty, I don't know which nodes you mean to select here but
perhaps
  select="following-sibling::*"

     <xsl:for-each select="$s1/item">
        <xsl:variable name="sub1" select="."/>

        <xsl:for-each select="$s2/item">
          <xsl:if test="$sub1 = . ">


This is rather strange, it loops through all pairs of items in s1
and s1 but only does anything if the items are equal 
so you could just select those pairs with a single xpath:
  <xs:for-each select="$s2/item[.=$s1/item]">

which is more compact to write and at least gives the system a chance of
being a bit more efficient.

It seems that you want to use an integer counter as your main control
and repeatedly pass the whole of yor set $s1 and keep accessing $s1[$i]
this isn't the usual XSL way, normally you would just simply pass the
current node as a parameter, and then move control to teh following
sibling, without ever needing your integer position variable.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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.