Re: [xsl] joining nodes

Subject: Re: [xsl] joining nodes
From: Rolf Schumacher <mailinglist@xxxxxxxxx>
Date: Thu, 16 Feb 2006 21:42:29 +0100
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: [xsl] 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