Project

Profile

Help

Bug #4131

closed

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

Added by Octavian Nadolu almost 6 years ago. Updated almost 6 years ago.

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

0%

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

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

tst.xsl (622 Bytes) tst.xsl Octavian Nadolu, 2019-02-11 14:47
src.xml (186 Bytes) src.xml Octavian Nadolu, 2019-02-11 14:47
Actions #1

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.

Actions #2

Updated by Octavian Nadolu almost 6 years ago

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

Actions #3

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

Also available in: Atom PDF