Project

Profile

Help

Bug #4131

XSLT Strange behaviour of xsl:analyze-string//xsl:copy

Added by Octavian Nadolu 7 months ago. Updated 7 months ago.

Status:
Closed
Priority:
Low
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
2019-02-11
Due date:
% Done:

0%

Legacy ID:
Applies to branch:
9.9
Fix Committed on Branch:
Fixed in Maintenance Release:

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>
tst.xsl (622 Bytes) Octavian Nadolu, 2019-02-11 14:47 tst.xsl
src.xml (186 Bytes) Octavian Nadolu, 2019-02-11 14:47 src.xml

History

#1 Updated by Martin Honnen 7 months 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.

#2 Updated by Octavian Nadolu 7 months ago

Thanks for your answer. I seems that I didn't read very well the specification.

#3 Updated by Michael Kay 7 months 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

Also available in: Atom PDF