xsl-list
[Top] [All Lists]

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

2013-09-07 19:01:42
At 2013-09-08 01:04 +0200, Heiko Niemann wrote:
whenever I searched for a way to insert a line break using the output text
method I basically just found samples either with & #10; or a line break
inside a xsl:text element. Those work as long as you don't do pretty print
or your editor at some point transforms & #10; to space. Anyhow while
flipping thru a well known XSLT/XPath reference codepoints-to-string()
crossed my way - and solved the problem.

Solved what problem? Expressing a line feed in a way that your editor doesn't corrupt it? Isn't that a problem with your editor or editing environment and not your stylesheet?

So that makes me wonder:

a) Is there a good reason/scenario why/when not to use this function for a
line break?

Because that isn't what it is meant to be used for? Or, at least, it isn't something I would expect it to be used for.

I'm just guessing that you are using...

   <xsl:value-of select="codepoints-to-string(10)"/>

... in place of the two cases you cite of either:

   <xsl:text>&#10;</xsl:text>

... or

<xsl:text>
</xsl:text>

Have I understood you correctly?

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?

I don't use it often, but I use it when it makes sense to use it. And I don't think it makes sense to use it merely to express a linefeed in your stylesheet. I'm sure a maintainer of your stylesheet would be confounded at such an expression.

Of course literal number values can be used as arguments to codepoints-to-string, but I've typically used calculated values or a range of values or a converted value from a data point of some kind. I've never thought to use literal number values since an XML numeric character reference achieves the same objective without taking the time to invoke an XPath function (noting, of course, that a processor may choose to rewrite the function call into a static expression).

I acknowledge that it is doing what you want it to do, but it just seems out of place to me and I would criticize its use in a stylesheet in this manner.

Perhaps others will not have any problems with it.

I hope this is considered helpful and constructive feedback.

. . . . . . . . . Ken

--
Public XSLT, XSL-FO, and UBL classes in the Netherlands     Oct 2013 |
Public XSLT, XSL-FO, UBL and code list classes in Australia Oct 2013 |
Contact us for world-wide XML consulting and instructor-led training |
Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm |
Crane Softwrights Ltd.            http://www.CraneSoftwrights.com/s/ |
G. Ken Holman                   mailto:gkholman(_at_)CraneSoftwrights(_dot_)com 
|
Google+ profile: https://plus.google.com/116832879756988317389/about |
Legal business disclaimers:    http://www.CraneSoftwrights.com/legal |


--~------------------------------------------------------------------
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>