Bug #4131
closedXSLT Strange behaviour of xsl:analyze-string//xsl:copy
0%
Description
If I apply the attached XSLT over the XML, the xsl:copy instruction generates a whitespace before each chunk of text, as:
<p>Z y t o lo g i e</p>
if I copy the text() by xsl:value-of, I'm getting the expected:
<p>Zytologie</p>
Files
Updated by Martin Honnen almost 6 years ago
I think the result is in accordance with the XSLT spec, your xsl:analyze-string
with the xsl:copy
https://www.w3.org/TR/xslt-30/#shallow-copy constructs a sequence of xs:string
values (i.e. all the non-matching substrings) and if you look at https://www.w3.org/TR/xslt-30/#constructing-complex-content
Any consecutive sequence of strings in the sequence is converted to a single text node, whose string value contains the content of each of the strings in turn, with a single space (#x20) used as a separator between successive strings.
you will see that there is a space inserted between strings in a sequence.
Updated by Octavian Nadolu almost 6 years ago
Thanks for your answer. I seems that I didn't read very well the specification.
Updated by Michael Kay almost 6 years ago
- Status changed from New to Closed
I agree with Martin's analysis.
This issue of space-separation between strings, but not between text nodes, has always been a problematic area in the spec, but the rules are clear-cut.
Marking as closed.
Please register to edit this issue