[xsl] transforming XML to XML with XSLT 1.0

Subject: [xsl] transforming XML to XML with XSLT 1.0
From: "Mark Kersten" <markker83@xxxxxxxxxxx>
Date: Fri, 20 May 2005 15:53:51 +0200
Hi all,

I've got the following problem:

I need to transform data I get from a database in an XML document, to another better formed XML document.

This is the xml that I get from the database:

<oda>
<Row AID="CD46" GROUP_TYPE="08" GROUP_VERSION="A" TIMEOUT="2" SHORT_MESSAGE="0066" PORT_NR="1" ACCESS_RIGHT="0" />
<Row AID="CD46" GROUP_TYPE="08" GROUP_VERSION="A" TIMEOUT="2" SHORT_MESSAGE="0066" PORT_NR="2" ACCESS_RIGHT="0" />
<Row AID="CD46" GROUP_TYPE="08" GROUP_VERSION="A" TIMEOUT="2" SHORT_MESSAGE="6280" PORT_NR="3" ACCESS_RIGHT="1" />
</oda>


And this is how it has to look like after the XSLT transformation:

<oda>
 <aid>CD46</aid>
<group>
 <type>08</type>
 <version>A</version>
 </group>
 <timeout>2</timeout>
 <shortmessage>0066</shortmessage>
 <shortmessage>6280</shortmessage>
<odaaccessrights>
<portaccess>
 <number>1</number>
 <enabled>0</enabled>
 </portaccess>
<portaccess>
 <number>2</number>
 <enabled>0</enabled>
 </portaccess>
<portaccess>
 <number>3</number>
 <enabled>1</enabled>
 </portaccess>
 </odaaccessrights>
</oda>

I've tried numerous solutions also listed on http://gandhimukul.tripod.com/grouping.html but I can't get any to work properly.

Current Thread