[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: one XML Format to other XML Format using XSLT
In a message dated 14/06/2003 09:32:45 GMT Daylight Time, xmlbar@h... writes: I am new to XML and in process of converting one XML format to another XML Bhargav, You have a couple of errors in A.xml. Assuming those are corrected then the following stylesheet gives you the output that you described. <?xml version='1.0'?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <xsl:output method="xml" indent="yes" encoding="UTF-8" /> <xsl:template match="/"> <xsl:apply-templates select="Employee" /> </xsl:template> <xsl:template match="Employee"> <xsl:copy> <xsl:attribute name="ID"> <xsl:value-of select="normalize-space(ID)" /> </xsl:attribute> <xsl:attribute name="Team"> <xsl:value-of select="normalize-space(Team)" /> </xsl:attribute> <xsl:copy-of select="Name" /> </xsl:copy> </xsl:template> </xsl:stylesheet> If you didn't intend the spaces in the value of the <Team> and <ID> elements you won't need the normalize-space() function in the stylesheet. XSLT questions are normally best asked on the XSL-List. See http://www.mulberrytech.com/xsl/xsl-list/index.html Andrew Watt
|
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
|