收到 XTRE1500 错误
Getting XTRE1500 error
我正在编写 XSLT,但出现以下错误。
XSLT 2.0 Debugging Error: Error: file:///C:/Users/u0138039/Desktop/Proview/SG/2016/SICC/XML/XSLT/chapters.xsl:5: Specified URI 'file:///C:/Users/u0138039/Desktop/Proview/SG/2016/SICC/XML/XSLT/chapters.xsl' is already used for writing - Details: - XTRE1500: Cannot write to an external resource and read from the same resource during a single transformation
我最近更换了我的机器,在我以前的系统中没有问题,在我当前的系统中,我遇到了这个错误。
错误抛出在
<xsl:variable name="ThisDocument" select="document('')"/>
在我的程序中,我使用它如下所示。
<xsl:variable name="d">
<xsl:value-of select="concat('toc-item-',$ThisDocument//ntw:nums[@num=$nu]/@word,'-level')"/>
</xsl:variable>
而 ntws 是屁股下面。
<!-- Namespace ntw-->
<ntw:nums num="1" word="first"/>
<ntw:nums num="2" word="second"/>
<ntw:nums num="3" word="third"/>
<ntw:nums num="4" word="forth"/>
<ntw:nums num="5" word="fifth"/>
<ntw:nums num="6" word="sixth"/>
<ntw:nums num="7" word="seventh"/>
<ntw:nums num="8" word="eighth"/>
<ntw:nums num="9" word="nighth"/>
<ntw:nums num="10" word="tenth"/>
<!-- Namespace ntw ends -->
这是我的完整 XSLT。 http://xsltransform.net/3NJ391b.
我用 Altova XML Spy。
请告诉我哪里出错了,我该如何解决。
谢谢,
拉凯什
不确定为什么在新机器上出现该错误,而在旧机器上却没有。可能是转换方式的不同 运行 或者 XML Spy 的版本可能不同。很难说不能重现问题。
您可以尝试不使用 document('')
。这不是必需的,因为您使用的是 XSLT 2.0。
尝试将 ntw:nums
元素直接移动到 ThisDocument
变量中:
<xsl:variable name="ThisDocument">
<ntw:nums num="1" word="first"/>
<ntw:nums num="2" word="second"/>
<ntw:nums num="3" word="third"/>
<ntw:nums num="4" word="forth"/>
<ntw:nums num="5" word="fifth"/>
<ntw:nums num="6" word="sixth"/>
<ntw:nums num="7" word="seventh"/>
<ntw:nums num="8" word="eighth"/>
<ntw:nums num="9" word="nighth"/>
<ntw:nums num="10" word="tenth"/>
</xsl:variable>
您可能希望在确认变量和引用正常工作后重命名该变量和引用。我还认为添加 as="element()+"
并更改用法会更具体一些。
这是我会做的一个例子...
ThisDocument
变量的替换:
<xsl:variable name="nums" as="element()+">
<ntw:nums num="1" word="first"/>
<ntw:nums num="2" word="second"/>
<ntw:nums num="3" word="third"/>
<ntw:nums num="4" word="forth"/>
<ntw:nums num="5" word="fifth"/>
<ntw:nums num="6" word="sixth"/>
<ntw:nums num="7" word="seventh"/>
<ntw:nums num="8" word="eighth"/>
<ntw:nums num="9" word="nighth"/>
<ntw:nums num="10" word="tenth"/>
</xsl:variable>
d
变量的替换:
<xsl:variable name="d">
<xsl:value-of select="concat('toc-item-',$nums[@num=$nu]/@word,'-level')"/>
</xsl:variable>
我正在编写 XSLT,但出现以下错误。
XSLT 2.0 Debugging Error: Error: file:///C:/Users/u0138039/Desktop/Proview/SG/2016/SICC/XML/XSLT/chapters.xsl:5: Specified URI 'file:///C:/Users/u0138039/Desktop/Proview/SG/2016/SICC/XML/XSLT/chapters.xsl' is already used for writing - Details: - XTRE1500: Cannot write to an external resource and read from the same resource during a single transformation
我最近更换了我的机器,在我以前的系统中没有问题,在我当前的系统中,我遇到了这个错误。
错误抛出在
<xsl:variable name="ThisDocument" select="document('')"/>
在我的程序中,我使用它如下所示。
<xsl:variable name="d">
<xsl:value-of select="concat('toc-item-',$ThisDocument//ntw:nums[@num=$nu]/@word,'-level')"/>
</xsl:variable>
而 ntws 是屁股下面。
<!-- Namespace ntw-->
<ntw:nums num="1" word="first"/>
<ntw:nums num="2" word="second"/>
<ntw:nums num="3" word="third"/>
<ntw:nums num="4" word="forth"/>
<ntw:nums num="5" word="fifth"/>
<ntw:nums num="6" word="sixth"/>
<ntw:nums num="7" word="seventh"/>
<ntw:nums num="8" word="eighth"/>
<ntw:nums num="9" word="nighth"/>
<ntw:nums num="10" word="tenth"/>
<!-- Namespace ntw ends -->
这是我的完整 XSLT。 http://xsltransform.net/3NJ391b.
我用 Altova XML Spy。
请告诉我哪里出错了,我该如何解决。
谢谢, 拉凯什
不确定为什么在新机器上出现该错误,而在旧机器上却没有。可能是转换方式的不同 运行 或者 XML Spy 的版本可能不同。很难说不能重现问题。
您可以尝试不使用 document('')
。这不是必需的,因为您使用的是 XSLT 2.0。
尝试将 ntw:nums
元素直接移动到 ThisDocument
变量中:
<xsl:variable name="ThisDocument">
<ntw:nums num="1" word="first"/>
<ntw:nums num="2" word="second"/>
<ntw:nums num="3" word="third"/>
<ntw:nums num="4" word="forth"/>
<ntw:nums num="5" word="fifth"/>
<ntw:nums num="6" word="sixth"/>
<ntw:nums num="7" word="seventh"/>
<ntw:nums num="8" word="eighth"/>
<ntw:nums num="9" word="nighth"/>
<ntw:nums num="10" word="tenth"/>
</xsl:variable>
您可能希望在确认变量和引用正常工作后重命名该变量和引用。我还认为添加 as="element()+"
并更改用法会更具体一些。
这是我会做的一个例子...
ThisDocument
变量的替换:
<xsl:variable name="nums" as="element()+">
<ntw:nums num="1" word="first"/>
<ntw:nums num="2" word="second"/>
<ntw:nums num="3" word="third"/>
<ntw:nums num="4" word="forth"/>
<ntw:nums num="5" word="fifth"/>
<ntw:nums num="6" word="sixth"/>
<ntw:nums num="7" word="seventh"/>
<ntw:nums num="8" word="eighth"/>
<ntw:nums num="9" word="nighth"/>
<ntw:nums num="10" word="tenth"/>
</xsl:variable>
d
变量的替换:
<xsl:variable name="d">
<xsl:value-of select="concat('toc-item-',$nums[@num=$nu]/@word,'-level')"/>
</xsl:variable>