Subject: RE: [xsl] is it possible to construct new xml with xsl ? From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx> Date: Sun, 16 Jun 2002 23:03:52 +0100 |
Oh dear, you really are very confused. The output of your transformation is a tree containing a single text node. When this tree is serialized, it will look like this if displayed in a text editor: <?xml version="1.0"?><students><theage>... When this is displayed by the browser it looks like this: <?xml version="1.0"?><students><theage>... Presumably you want to generate a file that *is* XML, not a file that *looks like* XML when displayed in the browser. So get rid of those CDATA sections, whose only purpose is to tell the XSLT processor not to treat the <student> as an XML tag, but rather as ordinary character data. Michael Kay Software AG home: Michael.H.Kay@xxxxxxxxxxxx work: Michael.Kay@xxxxxxxxxxxxxx > -----Original Message----- > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Meir > Sent: 17 June 2002 18:47 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: Re: [xsl] is it possible to construct new xml with xsl ? > > > Hello Thank for the reply > but what i meant was this : say i have this : > ******************************** THE XML > ******************************* <?xml version="1.0"?> > <?xml-stylesheet type="text/xsl" href="myxsl.xsl"?> <students> <male> > <age>20</age> > <name>shlomi</name> > </male> > <male> > <age>26</age> > <name>nadav</name> > </male> > </students> > > > ******************************** THE XSL > ******************************* <xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > <xsl:template match="/"> > > <![CDATA[<?xml version="1.0"?>]]> > <![CDATA[<myroot>]]> > > <xsl:for-each select="students/male"> > <![CDATA[<thestudent>]]> > <![CDATA[<theage>]]> > <xsl:value-of select="age"/> > <![CDATA[</theage>]]> > > <![CDATA[<thename>]]> > <xsl:value-of select="name"/> > <![CDATA[</thename>]]> > <![CDATA[</thestudent>]]> > </xsl:for-each> > > <![CDATA[</myroot>]]> > </xsl:template> > </xsl:stylesheet> > > the output of this xsl/xml is: > <?xml > version="1.0"?><myroot><thestudent><theage>20</theage><thename > >shlomi</thena > me></thestudent><thestudent><theage>26</theage><thename>nadav< > /thename>< > me>/the > student></myroot> > > that is ok , but its not loading as xml file .... > so here i have half job done all i need to know how i can > make IE to load/parse it as xml file . whitout saveing it > first to xml file.. thanks > > > > > > > ----- Original Message ----- > From: "Mike Brown" <mike@xxxxxxxx> > To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> > Sent: Sunday, June 16, 2002 12:17 PM > Subject: Re: [xsl] is it possible to construct new xml with xsl ? > > > > Meir wrote: > > > is there any way to construct new xml file from given xml > file with > > > xsl > > > > This is the most basic use of XSLT, transforming one XML > document into > > another. Read any XSLT tutorial. > > > > > when i load the xml file with the xsl file linked to it i > will see > > > in the IE new construction with the "+" and"-" > > > > IE will assume the output of the transformation is meant to be > > interpreted > as > > HTML. If you want collapsible views, you need to use a > stylesheet that > will > > produce the (D)HTML that makes the browser produce the view > you want. See > > http://www.dpawson.co.uk/xsl/sect2/microsoft.html#d58e229 > > > > - Mike > > > ______________________________________________________________ > ______________ > > mike j. brown | xml/xslt: http://skew.org/xml/ > > denver/boulder, colorado, usa | resume: > http://skew.org/~mike/resume/ > > > > 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] is it possible to constru, Joerg Heinicke | Thread | [xsl] normalize-space(me), Mike Ferrando |
Re: [xsl] is it possible to constru, Joerg Heinicke | Date | RE: [xsl] is it possible to constru, Michael Leditschke |
Month |