Project

Profile

Help

Bug #4110

closed

processing-instruction does not contain character when input matches '^\s+[a-z]$'

Added by Sebastian Bulka almost 6 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Internals
Sprint/Milestone:
-
Start date:
2019-01-24
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
9.6, 9.7, 9.8, 9.9, trunk
Fix Committed on Branch:
9.9, trunk
Fixed in Maintenance Release:
Platforms:

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 &#xa;).
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

whitespace_plus_char.xsl (690 Bytes) whitespace_plus_char.xsl Stylesheet generating the erroneous output Sebastian Bulka, 2019-01-24 17:43
Actions #1

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.

Actions #2

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

Actions #3

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

Also available in: Atom PDF