RE: applying xsl to xml to produce different xml

Subject: RE: applying xsl to xml to produce different xml
From: "Richard Lander" <rlander@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 2 Dec 1999 12:40:47 -0500
 Hello,

Thats easy.

Try:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  		    xmlns:xtfile="http://www.jclark.com/xt/java/java.io.File";
		    version="1.0"
                xmlns:xt="http://www.jclark.com/xt";
                extension-element-prefixes="xt">

<xsl:template match="books"/>

<xsl:template match="authors">
  <xsl:copy-of select=".">
    <xsl:apply-templates/>
  </xsl:copy-of>
</xsl:template>

<xsl:template match="author">
  <xsl:copy-of select=".">
    <xsl:apply-templates/>
  </xsl:copy-of>
</xsl:template>

</xsl:stylesheet>

Assume your file is called lib.xml and the stylsheet is lib.xsl, you'll want
to try:

xt lib.xml lib.xsl libout.xml
-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxx]On Behalf Of
Clay_Rowland@xxxxxxxxxxx
Sent: Thursday, December 02, 1999 12:07 PM
To: xsl-list@xxxxxxxxxxxxxxxx
Subject: applying xsl to xml to produce different xml




I would like to apply a stylesheet to an xml doc and produce a new xml doc
with
only part of the original xml.

for example:

xml 1:

<library>
     <books>
          <title>title 1</title>
          <title>title 2</title>
     </books>
     <authors>
          <author>author 1</author>
          <author>author 2</author>
     </authors>
</library>


into

xml 2:

<authors>
     <author>author 1</author>
     <author>author 2</author>
</authors>


i would like to return a new xml doc containg only the the node authors and
its
children nodes.  i would like to retain the data in its tagged form.

any suggestions?

thanks.



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


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


Current Thread