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

RE: number continuation problem

Subject: RE: number continuation problem
From: "Andrew Welch" <AWelch@xxxxxxxxxxxxxxx>
Date: Fri, 27 Jun 2003 13:17:56 +0100
if preceding sibling
David,

Thanks for your help so far, I could use it some more as Im really stuck converting what we have to multi-level...


<root>
	<if>
		<node>(1)</node>
	</if>
	<else>
		<node>(1)</node>
		<node>(2)</node>
		<node>(3)</node>
            <node>(4)</node>
            <if>
		  <node>(5)</node>
              <node>(6)</node>
	      </if>
	      <else>
		  <node>(5)</node>
	      </else>
	</else>
	<if>
		<node>(7)</node>
		<node>(8)</node>
	</if>
	<else>
		<node>(7)</node>
	</else>
</root>

Here the point of interest is the nested <if> in the first <else>.  The numbering should follow from the parent (as in brackets).

Im working with your last post:

1 +
count(preceding-sibling::node) +
count(parent::if/preceding-sibling::if[count(node)&gt;count(following-sibling::*[1][self::else]/node)]/node) +
count(parent::else/preceding-sibling::if[position()&gt;1][count(node)&gt;count(following-sibling::*[1][self::else]/node)]/node) +
count(../preceding-sibling::else[count(node)&gt;=count(preceding-sibling::*[1][self::if]/node)]/node

Im going down the route of selecting all preceding <step>'s, then filtering the ones we don’t want, instead of counting in all the ones we do (as it works at the moment).  Is that the right approach? 

I can virtually gurantee nesting only goes one deep, so I also tried adding another set of count()'s to the xpath that work on parents parents, but to no avail (and I think the preceding:: route is the preferred one).

Any further assistance would be great,

Cheers
andrew 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.491 / Virus Database: 290 - Release Date: 18/06/2003
 

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


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.