Project

Profile

Help

Bug #2951

closed

Incorrect results from analyze-string()

Added by Michael Kay over 7 years ago. Updated almost 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
XPath conformance
Sprint/Milestone:
-
Start date:
2016-09-21
Due date:
% Done:

100%

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

Description

Reported by Gerrit Imsieke on Saxon help list.

Test case analyze-string-096 added to XSLT 3.0 test suite.

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xs="http://www.w3.org/2001/XMLSchema" version="2.0">

  <xsl:variable name="regex" as="xs:string"
    select="'^(\p{Lu}{2}_\p{Lu}{3}_)?((\d{5})_)?(\d{5}).*$'" />
  <xsl:variable name="basename" as="xs:string"
    select="'UV_STD_00000_39000_Test'" />

  <xsl:template name="main">
    <xsl:analyze-string select="$basename" regex="{$regex}">
      <xsl:matching-substring>
        <xsl:message
          select="for $i in (1 to 4)
                  return concat($i, ':', regex-group($i))"/>
      </xsl:matching-substring>
    </xsl:analyze-string>
  </xsl:template>
</xsl:stylesheet>

Results are correct up to 9.6.0.7 and incorrect from 9.6.0.8.

Please register to edit this issue

Also available in: Atom PDF