xsl-list
[Top] [All Lists]

RE: joining nodes

2006-02-16 08:48:18
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(_at_)august(_dot_)de 
[mailto:mailinglist(_at_)august(_dot_)de] 
Sent: 16 February 2006 15:12
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>