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

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
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


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.