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

Re: New Line using XSLT

Subject: Re: New Line using XSLT
From: "Heiko Niemann kontakt@xxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 2 Mar 2016 10:26:37 -0000
Re:  New Line using XSLT
Hi,

when outputting text with new line(s) I favor using a value-of element
plus seperator with any number of nested sequence elements. For 'new line'
as seperator I prefer using codepoints-to-string(10), which worked for me
as the most reliable way. I bet there are pros and cons, but at the moment
this works best for me and seems to be the most flexible.

Sample:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
  <xsl:output method="text"/>
  <xsl:template match="/">
    <xsl:value-of separator="{codepoints-to-string(10)}">
      <xsl:for-each select="1 to 10">
        <xsl:sequence select="."/>
      </xsl:for-each>
    </xsl:value-of>
  </xsl:template>
</xsl:stylesheet>

One con would be that this reqires XSLT 2.0/XPath 2.0.


Heiko




> Hi,
>
> I want to generate a "text" file in which every row should be in separate
> line.
> I have use "&#x0A;,&#x0D;" and <xsl:text>
> </xsl:text>
>
> But all the above seems not to work.
>
> Please suggest.
>
> --
> Vishnu Singh | http://marklogicgd.blogspot.in/

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.