|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Transform XML
From: "Karl J. Stubsjoen" <karl@xxxxxxxxxxxxx>
> Hello, I need to take the following XML and transform it into something
> quite simpler, this might be the result:
>
> <?xml version="1.0">
> <FLDS>
> <FLD name="orig_fld_name"/>
> <FLD name="orig_fld_name"/>
> <FLD name="orig_fld_name"/>
> <FLD name="orig_fld_name"/>
> ...
> </FLDS>
This stylesheet:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"
version="1.0">
<xsl:output method="xml" />
<xsl:strip-space elements="xml"/>
<xsl:template match="/">
<FLDS>
<xsl:apply-templates/>
</FLDS>
</xsl:template>
<xsl:template match="s:Schema/s:ElementType/s:AttributeType">
<FLD name="{@name}"/>
</xsl:template>
</xsl:stylesheet>
Produces the following output over your inputs:
<?xml version="1.0" encoding="UTF-8"?>
<FLDS xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"><FLD
name="usr_memberID"/><FLD name="usr_UID"/><FLD name="USR_PWD"/><FLD
name="fname"/><FLD name="lname"/><FLD name="email"/><FLD name="email2"/><FLD
name="email3"/><FLD name="phone_home"/><FLD name="phone_cell"/><FLD
name="phone_fax"/><FLD name="phone_other"/><FLD name="address1"/><FLD
name="address2"/><FLD name="city"/><FLD name="state"/><FLD name="zip"/><FLD
name="notes"/><FLD name="Hire_Date"/><FLD name="Termination_Date"/><FLD
name="DOB"/></FLDS>
hth,
Mike
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








