Bug #4110
closedprocessing-instruction does not contain character when input matches '^\s+[a-z]$'
100%
Description
When a string starts with whitespace, followed by exactly 1 readable character, neither @select
nor <xsl:value-of>
outputs the character in a <xsl:processing-instruction>
.
When constructing a <xsl:element>
, it is generated as expected.
Amount of whitespace seems to be irrelevant (also tried with some 
).
Behaviour is as expected if the input has
- no whitespace before the 'z'
- whitespace after the 'z'
- more than 1 readable character following
I tried setting @as='xs:string'
(https://saxonica.plan.io/issues/3748), but that did not help.
Given:
- whitespace_plus_char.xsl
- Saxon-PE 9.6.0.7J or Saxon-PE 9.8.0.12
expected:
<?xml version="1.0" encoding="UTF-8"?><?s1 z?><?s2 z?><?s3 z?><w> z</w>
actual:
<?xml version="1.0" encoding="UTF-8"?><?s1?><?s2?><?s3?><w> z</w>
Files
Updated by Michael Kay almost 6 years ago
- Category set to Internals
- Assignee set to Michael Kay
- Priority changed from Low to Normal
- Applies to branch 9.7, 9.9, trunk added
Thanks for reporting this. It's a simple "off by one" bug that has gone unnoticed for a very long time: the internal method Whitespace.removeLeadingWhitespace()
returns a zero length string if the input is all whitespace except for the last character.
Construction of processing instructions is almost the only place that uses the method Whitespace.removeLeadingWhitespace()
. The only other case is when parsing XQuery pragmas, but they will never have only a single character after the whitespace.
Updated by Michael Kay almost 6 years ago
- Status changed from New to Resolved
- Fix Committed on Branch 9.9, trunk added
Fixed on 9.9 and trunk
Updated by O'Neil Delpratt over 5 years ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in Maintenance Release 9.9.1.2 added
Bug issue fixed in the Saxon 9.9.1.2 maintenance release.
Please register to edit this issue