Re: tutorial xml to xml using xslt
yes, you are right. That's what I get for not testing it first... The example I sent would work if you change the output to xml or replace the output tags so that the angle brackets are entities, for example: <foo> ----- Original Message ----- From: "Evan Lenz" <elenz@xxxxxxxxxxx> To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> Sent: Tuesday, February 20, 2001 4:35 PM Subject: RE: tutorial xml to xml using xslt > "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." > http://www.w3.org/TR/xslt#section-Text-Output-Method > > 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 <element>, which would result in the unescaped > <element>. > > 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: 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: > > 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: 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 > > > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format