|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] generalized template to transform elements to attributes
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








