[xsl] node concatenation

Subject: [xsl] node concatenation
From: "bix xslt" <bix_xslt@xxxxxxxxxxx>
Date: Fri, 28 Mar 2003 23:54:20 +0000
All,

I believe this may have been covered before with some of the grouping q/a's but I did a few searches both on the fact and the archive, and I was unable to find what I was looking for.

Essentially, I've got something similar to the following:
~~~~xml fragment~~~~
<element name="a">
 <attribute name="attA1"/>
 <attribute name="attA2"/>
 <element name="aa">
   <attribute name="attAA1"/>
   <attribute name="attAA2"/>
 </element>
</element>
<element name="b" />
<element name="a">
 <attribute name="attA3"/>
 <attribute name="attA4"/>
 <element name="ab">
   <attribute name="attAB1"/>
   <attribute name="attAB2"/>
   <element name="aba">
     <attribute name="attABA1"/>
     <attribute name="attABA2"/>
     <attribute name="attABA3"/>
     <attribute name="attABA4"/>
   </element>
 </element>
</element>
<element name="a"/>
<element name="b">
 <element name="ba"/>
</element>

I would like to combine all of the similar elements and reference the element children into something like this:
~~~ xml fragment output ~~~
<element name="a">
<attribute name="attA1"/>
<attribute name="attA2"/>
<attribute name="attA3"/>
<attribute name="attA4"/>
<elementRef name="aa"/>
<elementRef name="ab"/>
</element>
<element name="b">
<elementRef name="ba"/>
</element>
<element name="aa">
<attribute name="attAA1"/>
<attribute name="attAA2"/>
</element>
<element name="ab">
<attribute name="attAB1"/>
<attribute name="attAB2"/>
<elementRef name="aba">
</element>
....etc


I am attempting to come up with an automated way of storing off what the DTD is of the xml data produced by my database. My hope is that I can transform my original xml into this newer format (element/attribute), and then transform that into a DTD file. I have an xsl file that works through all of the original xml data and produces what you see above. However, I'm at a loss how to group/concatenate the multiple data outputs. If there is a better way to do this, I'd sure appreciate the help.

Thanks!
bix





_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread