This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Escaping newlines in an XSL file
- From: "Ranjith Kodikara" <Ranjith at dmsswt dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Wed, 5 Jun 2002 16:33:35 +0600
- Subject: Re: [xsl] Escaping newlines in an XSL file
- References: <63C4AD0365821F4291ACF76C0672FA3506EE91@piper6.piper-group.int>
- Reply-to: xsl-list at lists dot mulberrytech dot com
----- Original Message -----
From: "Andrew Welch" <awelch@piper-group.com>
To: <xsl-list@lists.mulberrytech.com>
Sent: Wednesday, June 05, 2002 3:55 PM
Subject: RE: [xsl] Escaping newlines in an XSL file
>
>
> Ahh the joys of whitespace. Here why not use <xsl:text>?
>
> <xsl:template match="/RECORD">
> <xsl:value-of select="child::ELEMENT_1"/><xsl:text>,</xsl:text>
> <xsl:value-of select="child::ELEMENT_2"/><xsl:text>,...</xsl:text>
> <xsl:value-of select="child::ELEMENT_n"/>
> </xsl:template>
>
> This should give you control over what appears in your output
>
> cheers
> andrew
>
>
>
> >Here's how I usually do it. Not quite as readable as you would like,
> but
> >fairly good.
> >
> ><xsl:template match="/RECORD">
> > <xsl:value-of select="child::ELEMENT_1"
> > />,<xsl:value-of select="child::ELEMENT_2"
> > />,...<xsl:value-of select="child::ELEMENT_n"/>
> > </xsl:template>
> >
> >Cheers,
> >
> >Tom P
> >
> >[ROBERTS Jeff]
> >
> > > I have the following problem:
> > >
> > > I have a Document tree that represents a single data record
> containing
> > > multiple fields. I would like to convert this into a comma delimited
> text
> > > string using XSL.
> > >
> > > My current approach is to use the following XSL:
> > >
> > > <xsl:template match="/RECORD">
> > > <xsl:value-of select="child::ELEMENT_1"/>,<xsl:value-of
> > > select="child::ELEMENT_2"/>,...<xsl:value-of
> select="child::ELEMENT_n"/>
> > > </xsl:template>
> > >
> > > Where RECORD is actually the root of the tree - there is only 1
> record
> per
> > > tree.
> > >
> > > My problem is that if I break up the second line in the above code
> so
> that
> > > there is one element per line (for readability)
> > >
> > > e.g.
> > >
> > > <xsl:value-of select="child::ELEMENT_1"/>,
> > > <xsl:value-of select="child::ELEMENT_2"/>,
> > > ...
> > > <xsl:value-of select="child::ELEMENT_n"/>
> > >
> > > Then XSL will output the newlines found after each comma to the
> resulting
> > > file.
> > >
> > > Does anyone know a way I can break up the line above without having
> XSL
> > > treat the New Lines as significant ?
> > >
> > > Perhaps I am walking down the wrong path with this. Unfortunately I
> have
> > > no experience with XSL. The only thing I need it for is to do this
> one
> > > simple transformation, but I'm finding the learning curve a little
> steep
> > > at the beginning.
> > >
> > > Would *greatly* appreciate any help on this one!
> > >
> > > Thanks
> > >
> > > Jeff Roberts
> > > Toronto
> > >
> > >
> > >
> >
> > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
> >
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
>
>
>
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.350 / Virus Database: 196 - Release Date: 17/04/2002
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.350 / Virus Database: 196 - Release Date: 17/04/2002
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list