xsl-list
[Top] [All Lists]

Re: [xsl] codepoints-to-string for new line

2013-09-07 19:13:17
On Sun, 2013-09-08 at 01:04 +0200, Heiko Niemann wrote:

b) Are there just no (top-rated) samples around because
codepoints-to-string() belongs to an extended set of functions that people
(like me) rarely/never use?

It's part of XSLT 2 [1], which doesn't have as widespread use as XSLT 1.

Using <xsl:value-of select="codepoints-to-string('10')" /> will indeed
give you a newline in cases where using an XML editor on your stylesheet
would turn &#10; into a literal newline which might then be reformatted
as a space by buggy ill-behaved software you shouldn't use :-) :-)

The right way for an editor to show indenting of XML documents is
visually, not by changing the text of the document.

Probably I'd have a global variable, 
<xsl:variable name="newline" select="codepoints-to-string('10')" />
and document in a comment why you are using it.

Then you can use concat("abc", $newline, "cde") to get something much
more readable.

Liam

[1] http://www.w3.org/TR/xpath-functions/#func-codepoints-to-string

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>