This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Keeping track of parents
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] Keeping track of parents
- From: "Daniel Newman" <daniel dot newman at bis-web dot com>
- Date: Fri, 13 Jul 2001 16:11:14 +0100
- Reply-To: xsl-list at lists dot mulberrytech dot com
You should let them do whatever they want, they're old enough... sheiks.
some people :-)
-----Original Message-----
From: owner-xsl-list@lists.mulberrytech.com
[mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of Christian
Cäsar
Sent: 13 July 2001 15:59
To: xsl-list@lists.mulberrytech.com
Subject: [xsl] Keeping track of parents
Hi there,
I'm a newbie, so please be patient with me if I cannot explain my problem
as I should. I am quite stumped on this.
This is my problem:
I have an XML-File with a structure like this (simplified):
<somenode id="1">
<more_elements/>
<somenode id="2">
<more_elements/>
<somenode id="3">
<more_elements/>
</somenode>
<somenode id="4">
<more_elements/>
</somenode>
</somenode>
That is, the element <somenode> can have children that are also called
<somenode>.
My result xml should look like this:
<structure>
<group_name value="some_value_from_more_elements"/>
<group_id value="some_unique_id_for_somenode"/>
<parent_id value="group_id_of_somenodes_parent"/>
</structure>
<structure>
<group_name value="some_value_from_more_elements"/>
<group_id value="some_unique_id"/>
<parent_id value="group_id_of_somenodes_parent"/>
</structure>
<structure>
<group_name value="some_value_from_more_elements"/>
<group_id value="some_unique_id"/>
<parent_id value="group_id_of_somenodes_parent"/>
</structure>
<structure>
<group_name value="some_value_from_more_elements"/>
<group_id value="some_unique_id"/>
<parent_id value="group_id_of_somenodes_parent"/>
</structure>
Most of it I can generate, but how can I fill the parentid? If there is no
ancestor-element named <somenode> then the parent_id should be 0, else the
parent_id should be the group_id of the ancestor.
If it matters: I'm using xalan.
Thanks for helping me,
Christian
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list