[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: Wed, 11 Feb 2004 02:00:30 -0800 (PST)
verizon data services india
Hi
Thanks a lot for the solution..The outcome is very
precise to my requirement..I am amazed at the power of
xsl transformations after looking at the code..

will come back with moe doubts in future..

Bye


--- David Carlisle <davidc@xxxxxxxxx> wrote:
> 
>  to address your doubt about why it is not enuf for
> me
>  to just use <xsl:copy-of select="Type/text()"/>
>  
>  instead of recursion i have to further explain what
> i
>  am trying to do..
> 
> See, it's always much easier to answer questions
> given sample input and
> desired output. You are correct that my one line
> xsl:copy can not add
> the  "_" between the items (In Xpath 2 this will be
> possible and the
> whole stylesheet below could be replaced by a single
> xsl:value-of)
> 
> However you don't need recursion, just a small
> for-each loop over the
> elements
> 
> 
> 
> <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
> <xsl:param name="x"/>
> <xsl:template match="Root">
>  <xsl:for-each
> select="Elements/Element[@name=$x]/R/Type">
>  <xsl:value-of select="/Root/*[name()=current()]"/>
>  <xsl:if test="position()!=last()">_</xsl:if>
>  </xsl:for-each>
> </xsl:template>
> </xsl:stylesheet>
> 
> 
> $ saxon concat.xml concat.xsl x=El1
> <?xml version="1.0" encoding="utf-8"?>R1_R2
> davidc@DCARLISLE /c/tmp
> $ saxon concat.xml concat.xsl x=El2
> <?xml version="1.0" encoding="utf-8"?>R1
> davidc@DCARLISLE /c/tmp
> $ saxon concat.xml concat.xsl x=El3
> <?xml version="1.0" encoding="utf-8"?>R1_R2_R3
> 
> 
> which matches your desired output I believe.
> 
> -- 
> http://www.dcarlisle.demon.co.uk/matthew
> 
>  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.