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

Re: Traversing the tree

Subject: Re: Traversing the tree
From: "Agnisys Technology \(P\) Ltd." <agnisys@xxxxxxxxx>
Date: Thu, 8 Sep 2005 18:59:57 -0700 (PDT)
Re:  Traversing the tree
David,
  Your alternate strategy works well and solves the problem.
  Although, I do need to study it carefully to understand how it is doing it!
Thanks,
Anupam.


--- David Carlisle <davidc@xxxxxxxxx> wrote:

> 
> 
> 
>   <xsl:variable name="reg">
>     <xsl:for-each select="//reg">
>       <xsl:copy-of select="."/>
>     </xsl:for-each>
>   </xsl:variable>
> 
> ..
>       <xsl:when test="$reg/
> 
> Note that's not legal in XSLT1 (as $reg is a result tree fragment) it's
> legal but expensive in xslt2 (as you have to copy all the nodes)
> 
> better to do
> 
>   <xsl:variable name="reg" select="//reg"/>
> 
> An alternative strategy would be
> 
> 
> <xsl:stylesheet version="1.0"
>               xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> 
> <xsl:template match="top">
> <xsl:for-each select="a/reg">
> :<xsl:variable name="x" select="(.|preceding-sibling::reg)[@offset][last()]"/>
> <xsl:value-of select="."/>:  <xsl:value-of select="sum($x/@offset) +
>     count(preceding-sibling::reg) - count($x/preceding-sibling::reg)"/>
> </xsl:for-each>
> </xsl:template>
> 
> </xsl:stylesheet>
> 
> 
> 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
> ________________________________________________________________________
> 
> 



	
		
______________________________________________________
Click here to donate to the Hurricane Katrina relief effort.
http://store.yahoo.com/redcross-donate3/

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.