This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: is it possible to construct new xml with xsl ?
- From: "Michael Kay" <michael dot h dot kay at ntlworld dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Sun, 16 Jun 2002 23:03:52 +0100
- Subject: RE: [xsl] is it possible to construct new xml with xsl ?
- Reply-to: xsl-list at lists dot mulberrytech dot com
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@ntlworld.com
work: Michael.Kay@softwareag.com
> -----Original Message-----
> From: owner-xsl-list@lists.mulberrytech.com
> [mailto:owner-xsl-list@lists.mulberrytech.com] On Behalf Of Meir
> Sent: 17 June 2002 18:47
> To: xsl-list@lists.mulberrytech.com
> 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@skew.org>
> To: <xsl-list@lists.mulberrytech.com>
> 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