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

impossible to implement this algorithm in xslt?

Subject: impossible to implement this algorithm in xslt?
From: "Tom Schmitter" <toms@xxxxxxxxxxxxxxxxx>
Date: Thu, 24 Jul 2008 16:29:13 -0700 (PDT)
 impossible to implement this algorithm in xslt?
I'm beginning to despair in the possibility that it may be impossible to
implement this algorithm in xslt. Perhaps one of you battle-hardened vets
could shed some light...
 
Input doc:
<doc>
	<sect depth="3">heading</sect>
	<A level="1">
		<B level="2">xx</B>
	</A>
	<sect depth="7">heading2</sect>
	<C level="1">
		<D level="2">yy</D>
	</C>
</doc>

Desired output:
<doc>
	<sect depth="3">heading</sect>
	<A level="4">
		<B level="5">xx</B>
	</A>
	<sect depth="7">heading2</sect>
	<C level="8">
		<D level="9">yy</D>
	</C>
</doc>

Note how the 'level' attributes in the output represent the sum of their
value in the input and the value of the 'depth' attribute of the <sect>
which precedes it.

Given the recursive processing paradigm of xslt, without the ability for a
template to return a value or to set a global variable, I can't figure out
how I can process the <sect>s and make the value of their 'depth'
attributes available for the processing of the other elements.

Would someone please tell me I'm missing something?!?

Thanks very much

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.