Uploaded image for project: 'XalanJ2'
  1. XalanJ2
  2. XALANJ-2186

Function number() throws StringIndexOutOfBoundsException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.7, 2.6, 2.5
    • None
    • Xalan
    • None
    • Xerces 2.5
      Java HotSpot Client VM (build 1.4.2_05-b04, mixed mode)
      Red Hat Enterprise Linux (Kernel 2.4.21-15.9.1.ELhugemem)

    Description

      In both Xalan 2.5 and 2.6, XSLT function number() throws a StringIndexOutOfBoundsExcpetion for a stylesheet and XML instance that XMLSpy successfully translates:

      [1209][maharder@paias1854:~]$ java org.apache.xalan.xslt.Process -IN project/revolver/common/trunk/config/xml/message1.xml -XSL project/revolver/common/trunk/config/xml/normalizer.xsl
      <?xml version="1.0" encoding="UTF-8"?>

      file:///ms/.global/ny.u/user/m/maharder/project/revolver/common/trunk/config/xml/normalizer.xsl; Line #14; Column #39; XSLT Error (javax.xml.transform.TransformerException): java.lang.StringIndexOutOfBoundsException: String index out of range: 3

      message.xml:

      <?xml version="1.0" encoding="UTF-8"?>
      <revolver:message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:revolver="http://xml.msdw.com/ns/revolver"
      xsi:schemaLocation="http://xml.msdw.com/ns/revolver message.xsd">
      <revolver:element1>Element 1</revolver:element1>
      <revolver:element2>
      <revolver:element3>-005</revolver:element3>
      <revolver:element4>00006</revolver:element4>
      </revolver:element2>
      <revolver:element5>4.65000</revolver:element5>
      </revolver:message>

      normalizer.xsl:

      <?xml version="1.0" encoding="UTF-8"?>
      <xsl:stylesheet version="1.0"
      xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
      xmlns:revolver="http://xml.msdw.com/ns/revolver"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />
      <xsl:template match="*">
      <xsl:copy>
      <xsl:apply-templates />
      </xsl:copy>
      </xsl:template>
      <xsl:template match="text()">
      <xsl:value-of select="number(.)"/>
      </xsl:template>
      </xsl:stylesheet>

      message.xsd:

      <?xml version="1.0" encoding="UTF-8"?>
      <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
      targetNamespace="http://xml.msdw.com/ns/revolver"
      elementFormDefault="qualified" attributeFormDefault="unqualified">
      <xs:element name="message">
      <xs:complexType>
      <xs:sequence>
      <xs:element name="element1" type="xs:string" />
      <xs:element name="element2">
      <xs:complexType>
      <xs:sequence>
      <xs:element name="element3" type="xs:integer" />
      <xs:element name="element4" type="xs:positiveInteger" />
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      <xs:element name="element5" type="xs:float" />
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      </xs:schema>

      Attachments

        1. message.xml
          0.5 kB
          Derek Mahar
        2. message.xsd
          0.8 kB
          Derek Mahar
        3. normalizer.xsl
          0.6 kB
          Derek Mahar
        4. normalizer-fix.xsl
          0.6 kB
          Derek Mahar

        Activity

          People

            Unassigned Unassigned
            derekmahar Derek Mahar
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: