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

RE: Correlate elements in 2 different trees?

Subject: RE: Correlate elements in 2 different trees?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 14 Jun 2006 15:16:21 +0100
list of different trees
You're essentially doing grouping: see
http://www.jenitennison.com/xslt/grouping

In 2.0 it would be something like:

<xsl:for-each select="Tree1/*, Tree2/*" group-by="name()">
  <xsl:sort select="current-grouping-key()"/>
  <xsl:copy>
    <xsl:copy-of select="current-group()/*"/>
  </xsl:copy>
</xsl:for-each>

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

> -----Original Message-----
> From: Leslie Young [mailto:xlr8sx@xxxxxxxxxxx] 
> Sent: 14 June 2006 14:51
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Correlate elements in 2 different trees?
> 
> I am trying to figure out how to process 2 trees in a XML 
> file using xslt 1.0. First I need to sort the elements 
> alphabetically. Then correlate the element and its attributes 
> found in both trees, then output the result to a html table.
> Any advise how to do this?  Thanks in advance!
> 
> Input xml:
> <Tree1>
>   <element3>
>     <child3 xxx yyy>
> 
>   <element2>
>     <child2 xxx yyy>
> 
>   <element1>
>     <child1 xxx yyy>
> </dataset1>
> 
> <Tree2>
>   <element1>
>     <child1 aaa bbb>
> 
>   <element3>
>     <child3 bbb>
> 
>   <element2>
>     <child2 aaa bbb>
> </dateset2>
> 
> 
> output to a html table:
>   <element1>  <child1 xxx yyy aaa bbb>
>   <element2>  <child2 xxx yyy aaa bbb>
>   <element3>  <child3 xxx yyy       bbb>
> 
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today 
> - it's FREE! 
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

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.