xsl-list
[Top] [All Lists]

[xsl] SOLVED: [xsl] xsl2 saxon8B stripping off unwanted separation characters

2006-07-07 05:44:23
Thanks to all for so many answers.
Here come some observations:

multiple elements...
===============
My XML coded in
<?xml version="1.0" encoding="UTF-8"?>
follows the structure
...
<td class="lycee">
        <a href="http://www.yyy.com"; target="_blank">
                Lycée Paul
                Cézanne</a>
</td>

Basically, it's a text taken from a web page, where
there is one and only one <a> element into a <td>.
The <a> element is compounded by attributes on the one
hand and by a text content on the other. The text is
spread on two lines.
In my first mail I copied only the las part of the Xpath.
Maybe I should precise that the Xpath is on more than one
level. Hence I rewrite here the examples with td/a instead
of a.

@Separator attribute in the xsl
===============================
<xsl:value-of separator=" " select="td/a"/>
The problem with xslt2 saxon8B stripping off unwanted
separation characters remains the same whether
there is or there isn't a @separator=" " in the xsl.
<xsl:value-of select=fn:normalize-space("td/a")/> generates
the same error

"A sequence of more than one item is not allowed as
the first argument of normalize-space()
URL: http://www.w3.org/TR/xpath20/#ERRXPTY0004";

fn:normalize-unicode()
====================
Same error as with fn:normalize-space()

Choosing the first element of <td/a>
================================
Micheal Kay's solution to replicate XSLT 1 behavior
in XSLT2 by writing <xsl:value-of select="td/a[1]"/>
doesn't solve the problem:

<xsl:value-of select="a[1]"/> shows the undesired
"&#xA;              " in the result
<xsl:value-of select="normalize-space(td/a[1])"/>
creates an error
"A sequence of more than one item is not allowed as
the first argument of normalize-space()
URL: http://www.w3.org/TR/xpath20/#ERRXPTY0004";

THE SOLUTION
============
--drkm gave the solution of the problem in his first
message
<xsl:value-of separator=" " select="td/a/normalize-space()"/>
works with Saxon8B
<xsl:value-of select="td/a/normalize-space()"/>
works as well

It is quite interesting to observe that this solution
doesn't work with Saxon6.5.5 or with Xalan

MY CONCLUSION
==============
For Saxon 6.5.5 and Xalan, normalize-space should
enclose the Xpath.
For Saxon 8B, normalize-space should be apended
to the Xpath.

Thanks a lot to all,
Best regards,
Jacques Fauquex


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