xsl-list
[Top] [All Lists]

RE: Modifying XML file

2005-02-28 23:44:03
Hi,

    Let's say I have 2 XML nodes <a>, and <c>.  My
ultimate goal is to add a third node, <b>, in between
<a>, and <c> in the XML file.  I would like to do this
using an XSL transformation, with both the original
file and the output file in XML format.  What would
this part of the XSL look like?

<xsl:template match="a">
  <xsl:copy>
    <xsl:apply-templates select="@* | node()"/>
  </xsl:copy>
  <b/>
</xsl:template>
<xsl:template match="@* | node()">
  <xsl:copy>
    <xsl:apply-templates select="@* | node()"/>
  </xsl:copy>
</xsl:template>

Also, for the output
to be in XML format, do I ONLY need to change the
output method to "xml", or is there more to it? 
Thanks so much.

xsl:output method defaults to "xml" (there are cases when "html" is the 
default, see the spec for details), so you don't need to set it.

Cheers,

Jarno - Solitary Experiments: The Dark Inside Me (Lights of Euphoria mixb)

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>