Re: [xsl] tutorial xml to xml using xslt

Subject: Re: [xsl] tutorial xml to xml using xslt
From: Robert Koberg <rob@xxxxxxxxxx>
Date: Tue, 20 Feb 2001 15:39:05 -0800
There is an excellent book on XSLT by Michael Kay on Wrox press called
Professional XSLT or something like that.  If you need to get up to speed
fast, this book is the best way (THE best book out there on the subject).
Michael Kay is also the writer of Saxon (a very popular XSL processor). The
book will show you how to do pretty much anything with XSLT (which is alot).
Also there is a very active XSL list at:
http://www.mulberrytech.com/xsl/xsl-list/index.html

What you want is very similar to outputting HTML so the tutorials you have
found will work. Just change the xsl:output to xml rather than html.  Or you
could just output text and put in all the necessary info that way. (I have
made a simple example below that outputs to text)

Alternatively you might be interested in a utility on alphaworks:
http://www.alphaworks.ibm.com/
that will convert one xml document to another using the two documents DTDs.
I don't remember the name, sorry.

The example
=================================
xml document:

<article>
  <title> the title</title>
  <para> a para para para para para</para>
</article>
---------------------
an xsl:

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="text"/>

<xsl:template match="article">
   <foo>
      <xsl:apply-templates/>
   </foo>
</xsl:template>

<xsl:template match="title">
    <foo.title><xsl:apply-templates/></foo.title>
</xsl:template>

<xsl:template match="para">
    <foo.para><xsl:apply-templates/></foo.para>
</xsl:template>

</xsl:stylesheet>
-----------------------------------
the output:

<foo>
   <foo.title>the title</foo.title>
   <foo.para>a para para para para para</foo.para>
</foo>


----- Original Message -----
From: "Tom Belich" <TBelich@xxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Tuesday, February 20, 2001 2:46 PM
Subject: [xsl] tutorial xml to xml using xslt


> Does anyone know of a good tutorial for transforming xml to another xml
> document using xslt?  All the ones I've seen describe xml to html
> transformations.  I need to transform an experiment xml file into an xml
> file that I can add to my database.
>
>  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