xalan-j-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <philip.mi...@thomsonreuters.com>
Subject Date:Date throws IndexOutOfBounds Exception on empty input
Date Thu, 30 Jan 2014 18:58:31 GMT

When running the following XSL file Xalan-J 2.7.1 throws java.lang.StringIndexOutOfBoundsException:
String index out of range: 0 - String index out of range: 0
As long as the root node does not have an attribute named "anAttribute".

Expected output is an single root node
indicates that it should produce an empty string instead of throwing
"If the argument is not in either of these formats, date:date returns an empty string ('')"
Saxon produces the expected. output

If the null check where moved to the start of the date function it world work as specified.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    extension-element-prefixes="date exsl"
    <xsl:template match="/">
        <xsl:element name="root">
            <xsl:value-of select="date:date(@anAttribute)"/>

Is this a bug? Should I write it up?
Philip Miess

View raw message