xsl-list
[Top] [All Lists]

Re: [xsl] Line feed in xalan, disappears

2012-11-19 14:27:20
I just noticed you said you're "producing html" - I assume that means
<xsl:output method="html/>

If that's the case, don't forget that in HTML, a newline and/or
carriage-return are both considered
whitespace, so the output won't actually start a new line unless you
produce a "<br/>" element to
achieve a new line in a browser or other HTML rendering environment.

So assuming that your context node is "message", you would do this:

<xsl:value-of disable-output-escaping="yes"
            select="concat(substring-before(.,'&#10;'),
            '&lt;br/&gt;', substring-after(.,'&#10;'),'&#10;')"/>

(kind of hideous...)

or this:

        <xsl:value-of select="substring-before(.,'&#10;')"/><br/>
        <xsl:value-of select="substring-after(.,'&#10;')"/>


On Sat, Nov 17, 2012 at 5:13 AM, Mansour Al Akeel
<mansour(_dot_)alakeel(_at_)gmail(_dot_)com> wrote:
Hello all,
I am having an odd issue and has been stuck on it for some time. I am
maintaining one of the existing xslts, that produces html.
The resulting text, is concatenated where there's a line feed (x0A).
for for example if I have in my xml:

<message>I love
xslt</message>

and in my xslt:
<xsl:value-of select="message" />

Then the results is:

I lovexslt

The result doesn't have space or line feed. The xslt is applied
through the JSTL  <x:transform>.

Thank you all.

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


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