[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] problem adding a new element to an XML document using
I'm trying to transform the following small XML file:
<?xml version = '1.0'?> <ROWSET> <ROW num="1"> <PARTNO>1735</PARTNO> <PARTNAME>Gizmo</PARTNAME> </ROW> <ROW num="2"> <PARTNO>7364</PARTNO> <PARTNAME>Bowl</PARTNAME> </ROW> </ROWSET> into to this one <?xml version = '1.0'?> <ROWSET> *<TABLE>mytable</TABLE>* <ROW num="1"> <PARTNO>1735</PARTNO> <PARTNAME>Gizmo</PARTNAME> </ROW> <ROW num="2"> <PARTNO>7364</PARTNO> <PARTNAME>Bowl</PARTNAME> </ROW> </ROWSET> As you can see, all I want to do is use an XSL stylesheet to insert a new <TABLE> element and corresponding value in the output XML file, and leave everything else unchanged. Here's my stylesheet: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/> <xsl:template match="/"> <xsl:apply-templates/> </xsl:template> <xsl:template match="ROWSET"> <xsl:element name="TABLE"> <xsl:text>mytable</xsl:text> <xsl:apply-templates/> </xsl:element> </xsl:template> </xsl:stylesheet> When run, the output is: <TABLE>mytable1735Gizmo7364Bowl</TABLE> Any ideas what I'm doing wrong? It's important to note that I won''t necessarily know the names of the subelements of <ROW>, as these represent column names in an Oracle table. thanks in advance - Garry
|
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
|