Project

Profile

Help

Bug #6495

open

Spurious warning for xs:integer

Added by Norm Tovey-Walsh 3 months ago. Updated 3 months ago.

Status:
New
Priority:
Low
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
2024-08-07
Due date:
% Done:

0%

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

Description

On the xslt-list, Roger reports that this stylesheet generates a spurious warning:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                exclude-result-prefixes="xs"
                version="3.0">

<xsl:template match="/">
    <arcRadius>
        <xsl:variable name="legacy-ARINC-elmt-name" select="'ARC_Radius'" as="xs:string"/>
        <xsl:variable name="legacy-ARINC-elmt-value" select="'      '" as="xs:string"/>
        <xsl:variable name="whole-part" select="substring($legacy-ARINC-elmt-value,1,3)"/>
        <xsl:variable name="fraction-part" select="substring($legacy-ARINC-elmt-value,4,3)"/>
        <xsl:if test="$whole-part castable as xs:integer">
            <xsl:value-of select="concat(xs:string(xs:integer($whole-part)),'.',$fraction-part)"/>
        </xsl:if>
    </arcRadius>
</xsl:template>

</xsl:stylesheet>

And indeed it does:

Warning at char 29 in xsl:value-of/@select on line 14 column 99 of out.xsl:
  SXWN9027  Evaluation will always throw a dynamic error: Cannot convert zero-length string
  to an integer
<?xml version="1.0" encoding="UTF-8"?><arcRadius/>

This is a reported as a regression from 10.x EE to 12.5 EE.

Please register to edit this issue

Also available in: Atom PDF