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

Re: How to create new xml elements using xslt?

Subject: Re: How to create new xml elements using xslt?
From: Elizabeth Barham <soggytrousers@xxxxxxxxx>
Date: 07 Feb 2002 10:35:38 -0600
xslt create new xml
"Khalid"<k_ali@xxxxxxxxxxxxxxx> writes:

> I can read 2 xml files and create a single file output with some
> selected nodes from both files,but I want to create some new
> elements aswell and they may be appended in the beginning or at the
> end of the created document and I may want to insert a new element
> in the middle of the this newly created document.  Can some one
> guide me to how to get this done.
>
>  btw. I can read 2files and a print a new file with selected
> elements.


<xsl:element> ??

<http://nwalsh.com/docs/tutorials/xsl/xsl/foil99.html>

For example,

  <xsl:template match="/">
    <xsl:element name="myNewDoc">
      <xsl:attribute name="test-attribute">
	<xsl:text>Value of Attribute</xsl:text>
      </xsl:attribute>
      <xsl:apply-templates />
    </xsl:element>
  </xsl:template>

Original XML:
<?xml version="1.0"?>
<test>
  Hi This is the text of the root node entitled test
  <test-a>
    and a
  </test-a>
  <test-b>
    and b
  </test-b>
</test>

Transformed XML:

<?xml version="1.0" encoding="UTF-8"?>
<myNewDoc test-attribute="Value of Attribute">
  Hi This is the text of the root node entitled test
  
    and a
  
  
    and b
  
</myNewDoc>


hth, Elizabeth

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.