XSL转换 - JAXPSAXProcessor

时间:2015-12-19 06:26:10

标签: xml eclipse xslt

我有以下简单的xslt和输入xml,在eclipse Mars中进行转换...但是当我运行这个时,得到“String Index out of range error”

任何人都可以租借提示修复吗?是因为日期功能吗?

XSL

<xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xalan="http://xml.apache.org/xslt"
    xmlns:str="http://exslt.org/strings"
    xmlns:set="http://exslt.org/sets"
    xmlns:math="http://exslt.org/math"
    xmlns:exsl="http://exslt.org/common"
    xmlns:date="http://exslt.org/dates-and-times"
    version="1.0">
  <xsl:output method="xml" encoding="UTF-8" indent="no"/>


  <xsl:template match="/">
        <xsl:apply-templates select="Top" mode="create"/>
  </xsl:template>


  <xsl:template match="Top"  mode="create">
    <Root>


      <body>

        <out>
          <Temp>

            <Temp1>

              <data>
                <xsl:value-of select="date:date()"/>
              </data>
            </Temp1>
          </Temp>
        </out>
      </body>
    </Root>
  </xsl:template>

</xsl:stylesheet>

XML

<Top></Top>
变换后的eclipse中出现

错误 - Eclipse Mars,xml透视,JAXPSAXProcessorInvoker

Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.substring(Unknown Source)
    at com.sun.org.apache.xalan.internal.lib.ExsltDatetime.date(Unknown Source)
    at map_getLoanAgmt_to_manageLoanAgmtPHStatement_MF_req_1.template$dot$1()
    at map_getLoanAgmt_to_manageLoanAgmtPHStatement_MF_req_1.applyTemplates1()
    at map_getLoanAgmt_to_manageLoanAgmtPHStatement_MF_req_1.template$dot$0()
    at map_getLoanAgmt_to_manageLoanAgmtPHStatement_MF_req_1.applyTemplates()
    at map_getLoanAgmt_to_manageLoanAgmtPHStatement_MF_req_1.transform()

修改

我在Eclipse中将XSL的处理器更改为Xalan 2.7.1。但它仍然无法正常工作。

0 个答案:

没有答案