[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] number continuation problem


Subject: RE: [xsl] number continuation problem
From: "Andrew Welch" <AWelch@xxxxxxxxxxxxxxx>
Date: Fri, 27 Jun 2003 13:17:56 +0100

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
Keywords