[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Escaping newlines in an XSL file

Subject: Re: Escaping newlines in an XSL file
From: "Thomas B. Passin" <tpassin@xxxxxxxxxxxx>
Date: Tue, 4 Jun 2002 15:39:02 -0400
Re:  Escaping newlines in an XSL file
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.