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

RE: Joining children attributes with parent

Subject: RE: Joining children attributes with parent
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 3 Dec 2004 23:00:36 -0000
ross niemi
No problem. In XSLT 2.0:

xsl:for-each select="//*"
  xsl:value-of select="string-join(ancestor-or-self::*/@att, ',')"

Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: Ross Niemi [mailto:ross.niemi@xxxxxxxxx] 
> Sent: 03 December 2004 22:48
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Joining children attributes with parent
> 
> I'm not too sure if this is even possible in XSLT or if it may be too
> slow when implemented (since a parent node may need to be revisited
> multiple times), but this is what I'm trying to do:  I'm trying to
> join a set of parent's attributes with its children's attributes and
> their children's attributes for an arbitrary number of descendants
> (this will be displayed in CSV format).  Would be nice if there is a
> way to do this bottom up.
> 
> input:
> 
> parent1
>   child1
>   child2
> parent2
>   child3
>   child4
>     grandchild1
>     grandchild2
> 
> output (assuming each element is a set of attributes for the 
> element above):
> 
> parent1,child1
> parent1,child2
> parent2,child3
> parent2,child4,grandchild1
> parent2,child4,grandchild2
> 
> Cheers!
> 
> -- Ross

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.