RE: [xsl] tutorial xml to xml using xslt

Subject: RE: [xsl] tutorial xml to xml using xslt
From: "Evan Lenz" <elenz@xxxxxxxxxxx>
Date: Tue, 20 Feb 2001 16:35:08 -0800
"The text output method outputs the result tree by outputting the
string-value of every text node in the result tree in document order without
any escaping."

I don't know which XSLT processor you are using, but literal result elements
(or any elements for that matter) are not supposed to show up in the
serialization when the output method is set to "text", unless they are just
characters, such as &lt;element>, which would result in the unescaped

The correct output to your example should be something like this instead:

   the title
   a para para para para para

For transforming XML into XML, you should stick to the "xml" output method,
which is the default when not specified.

Evan Lenz
XYZFind Corp.

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Robert Koberg
> Sent: Tuesday, February 20, 2001 3:39 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] tutorial xml to xml using xslt
> 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:
> 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:
> 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="";>
> <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:
> >
>  XSL-List info and archive:

 XSL-List info and archive:

Current Thread