generalized template to transform elements to attributes

Subject: generalized template to transform elements to attributes
From: Honglin Su <hosu@xxxxxxxxxxx>
Date: Tue, 03 Aug 1999 11:06:37 -0400
Hi, there,

I am using XSL to transform one XML file to another, there is some rules
for my transformation. If the element has only PCDATA, then convert it
to the attribute of the parent element, if the element has more than
PCDATA ( such as attributes), keep it as a element in the result XML
tree.

e.g.

<atom  phase="gas">
   <name>Hydrogen</name>
   <symbol>H</symbol>
   <boiling_point units="Kelvin">20.28</boiling_point>
</atom>

the result one:
<atom phase="gas" name="Hydrogen" symbol="H">
    <boiling_point units="Kelvin">20.28</boiling_point>
</atom>

For the XSLT, if I want it just do this, that's not difficult. I hope
that this XSL can be used for any other XML file.

Thank you!

Honglin


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


Current Thread