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

RE: Modifying XML file

Subject: RE: Modifying XML file
From: <Jarno.Elovirta@xxxxxxxxx>
Date: Tue, 1 Mar 2005 08:44:03 +0200
modifying xml nodes
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)

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.