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

Path according to a child node attribute

Subject: Path according to a child node attribute
From: "Gian Paolo Bernardini" <eu1517395@xxxxxxxxx>
Date: Sat, 31 Dec 2011 11:36:19 +0100
 Path according to a child node attribute
Hi all,

Many thanks to Markus Abt for the solution to a previous post. For now I'm
struggling on a path building, according to a child node attribute
Supposing an xml hierarchically ordered like this:

<?xml version="1.0" encoding="UTF-8"?>
<root>
	<Class code="B">
		<SubClass code="b1"/>
		<SubClass code="b2"/>
		<Rubric>FUNZIONI CORPOREE</Rubric>
	</Class>
	<Class code="b1">
		<SuperClass code="B"/>
		<SubClass code="b110-b139"/>
		<Rubric>FUNZIONI MENTALI</Rubric>
	</Class>
	<Class code="b110-b139">
		<SuperClass code="b1"/>
		<SubClass code="b110"/>
		<Rubric>FUNZIONI MENTALI GLOBALI</Rubric>
	</Class>
	<Class code="b110">
		<SuperClass code="b110-b139"/>
		<Rubric>Funzioni della coscienza</Rubric>
	</Class>
	<Class code="b2">
		<SuperClass code="B"/>
		<SubClass code="b210-b229"/>
		<Rubric>FUNZIONI SENSORIALI E DOLORE</Rubric>
	</Class>
	<Class code="b210-b229">
		<SuperClass code="b2"/>
		<SubClass code="b210"/>
		<Rubric>FUNZIONI VISIVE E CORRELATE</Rubric>
	</Class>
	<Class code="b210">
		<SuperClass code="b210-b229"/>
		<Rubric>Funzioni della vista</Rubric>
	</Class>
</root>

I'd like to transform it in a form like this:

<?xml version="1.0" encoding="UTF-8"?>
<root>
	<Class code="B">
		<SubClass code="b1"/>
		<SubClass code="b2"/>
		<Rubric>FUNZIONI CORPOREE</Rubric>
		<Path></Path>
	</Class>
	<Class code="b1">
		<SuperClass code="B"/>
		<SubClass code="b110-b139"/>
		<Rubric>FUNZIONI MENTALI</Rubric>
		<Path>B FUNZIONI CORPOREE</Path>
	</Class>
	<Class code="b110-b139">
		<SuperClass code="b1"/>
		<SubClass code="b110"/>
		<Rubric>FUNZIONI MENTALI GLOBALI</Rubric>
		<Path>B FUNZIONI CORPOREE/b1 FUNZIONI MENTALI</Path>
	</Class>
	<Class code="b110">
		<SuperClass code="b110-b139"/>
		<Rubric>Funzioni della coscienza</Rubric>
		<Path>B FUNZIONI CORPOREE/b1 FUNZIONI MENTALI/b110-b139
FUNZIONI MENTALI GLOBALI</Path>
	</Class>
	<Class code="b2">
		<SuperClass code="B"/>
		<SubClass code="b210-b229"/>
		<SubClass code="b230-b249"/>
		<Rubric>FUNZIONI SENSORIALI E DOLORE</Rubric>
		<Path>B FUNZIONI CORPOREE</Path>
	</Class>
	<Class code="b210-b229">
		<SuperClass code="b2"/>
		<SubClass code="b210"/>
		<Rubric>FUNZIONI VISIVE E CORRELATE</Rubric>
		<Path>B FUNZIONI CORPOREE/b2 FUNZIONI SENSORIALI E
DOLORE</Path>
	</Class>
	<Class code="b210">
		<SuperClass code="b210-b229"/>
		<Rubric>Funzioni della vista</Rubric>
		<Path>B FUNZIONI CORPOREE/b2 FUNZIONI SENSORIALI E
DOLORE/b210-b229 FUNZIONI VISIVE E CORRELATE</Path>
	</Class>
	<Class code="b230-b249">
		<SuperClass code="b2"/>
		<Rubric>FUNZIONI UDITIVE VESTIBOLARI</Rubric>
		<Path>B FUNZIONI CORPOREE/b2 FUNZIONI SENSORIALI E
DOLORE</Path>
	</Class>
</root>

I'm founding difficulties on adding a child element as last child of the
node (i.e. <Path>) and on making the right path building (i.e. accessing the
attributes and values of the father, of the grandfather or of the great
grandfather based on the SuperClass code of each Class).
Using SaxonHE9-4-0-1J.

Any ideas? Thanks in advance

GB

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.