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

Re: Problem with xslt recursion

Subject: Re: Problem with xslt recursion
From: Roopesh Kumar <roopeshkumar_in@xxxxxxxxx>
Date: Tue, 10 Feb 2004 11:11:27 -0800 (PST)
roopesh kumar
hi david..
The solution that you gave for using
/a/b/*[name()=$path]
works fine..

Thanks a lot..


--- David Carlisle <davidc@xxxxxxxxx> wrote:
> 
> > [number($Index)]
> 
> you would have been better to have kept Index as a
> number rather than
> forcing it back to a number.
> 
> ie don't do this:
> 
> <xsl:with-param name="Index"><xsl:value-of
> select="$Index+1"/></xsl:with-param>
> 
> 
> do this
> 
> <xsl:with-param name="Index" select="$Index+1"/>
> 
> Never use xsl:variable with content instead of a
> select attribute
> unless you intend to do that. It is quite expensive.
> You are starting with a number then generating a
> text node with the
> string value of that number, placing that in a root
> node, making a result
> tree fragment of that, and then converting the whole
> thing back to a
> number with number().
> 
> 
>   The purpose is solved but i want to know if it is
> the
>   right thing to do....
> 
> Impossible to say given your description, but it
> seems unlikely that
> you need recursion at all. As I said in my reply
> your stated aim of
> concatenating the text can be done with a single
> line:
> 
> <xsl:copy-of select="Type/text()"/>
> 
> <xsl:variable name="fullpath"
> select="concat('/a/b/',$path)"/>
> 
> 
> This is a FAQ Xpaths are not strings, they are part
> of the syntax of
> the language. In C or Java or most other programming
> languages, if you
> had  a variable x with value 2 and the string "x+2" 
> it wouldn't be
> trivial to get the value 4: you'd have to write a
> parser to parse the
> string and access the referenced  constructs. It is
> the same in XPath,
> if you have a string that looks like an XPath then
> this is no use to you
> unless you have an Xpath parser that is callable at
> run time. Some
> systems do have such an extension, eg saxon:evaluate
> but it is not a
> standard part of the language.
> 
> In simple cases such as your first
> 
> <xsl:variable name="path">c</xsl:variable>
> (which would be better as
>   <xsl:variable name="path" select="'c'"/>
> )
> <!-- Now i am trying to access the dynamic path
> a/b/c
> 
> you can do
> 
> /a/b/*[name()=$path]
> 
> This really is a FAQ see the faq that is linked from
> the home page of
> this list.
> 
> David
> 
> 
> 
> -- 
> http://www.dcarlisle.demon.co.uk/matthew
> 
>
________________________________________________________________________
> This e-mail has been scanned for all viruses by Star
> Internet. 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
>
________________________________________________________________________
> 
>  XSL-List info and archive: 
> http://www.mulberrytech.com/xsl/xsl-list
> 


=====
Luv
Roopesh
Software Engineer 
Verizon Data Services India 
[98842-40222]

__________________________________________________________________

One manages uncertainty; one does not solve it.  
Eliminating uncertainty eliminates opportunity.  
Chaos is the engine of evolution.

__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

 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.