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

Re: joining nodes

Subject: Re: joining nodes
From: Rolf Schumacher <mailinglist@xxxxxxxxx>
Date: Thu, 16 Feb 2006 21:42:29 +0100
joining nodes
Yes, thank you for the link.
The solving method is called "Muenchian Method".
If I would have performance problems there are improvements possible.

However, the first method fits for me.

Rolf

Michael Kay wrote:

I'm having difficulty abstracting your two specific problems to identify the
general problem that you want to solve.

However, they're both in the area called "grouping", and you can get
guidance at http://www.jenitennison.com/xslt/grouping.

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





-----Original Message-----
From: mailinglist@xxxxxxxxx [mailto:mailinglist@xxxxxxxxx] Sent: 16 February 2006 15:12
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: joining nodes


I'm about new to XSLT and would like to ask you for help before I pay
another unsuccessful weekend.

I would like to join nodes. Can you point me to some words of how to
achieve that?

I'll describe the task in two examples. The perfect answer to my question
would be a stylesheet, but a hint can do as well.


Input:
<join1>
<aaa>
 <a>
   <name>n1</name>
   <value1>v11</value1>
 </a>
 <a>
   <name>n2</name>
   <value1>v12</value1>
 </a>
</aaa>
<bbb>
 <a>
   <name>n1</name>
   <value2>v21</value2>
 </a>
 <a>
   <name>n2</name>
   <value2>v22</value2>
 </a>
</bbb>
</join1>

should be transformed to the (text) output:

n1
 v11
 v21
n2
 v21
 v22

because n1 is associated to v11 and v21 and n2 is associated to v21 and
v22 in <aaa/> and <bbb/> respectively.


<join2>
<aaa>
 <ident>id1</ident>
 <ident>id3</ident>
</aaa>
<bbb>
 <ccc>
   <ident>id1</ident>
   <subject>sb1</subject>
 </ccc>
 <ccc>
   <ident>id2</ident>
   <subject>sb2</subject>
 </ccc>
 <ccc>
   <ident>id3</ident>
   <subject>sb3</subject>
 </ccc>
</bbb>
</join2>

should be transformed to the (text) output:

id1 sb1
id3 sb3

because id2 is missing in <aaa/>

I tried nested for-each but didn't succeed. I had no clue how to address
this task with template rules.


Thanks in advance

rolf

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.