Xml xquery fn:id不工作,即使type=xs:id似乎声明正确
我正在使用Altova开发一个运行在服务器上的XSLT转换。我需要修改一些东西,并在本地使用Oxgen,使用saxon解析器。由于某些原因,fn:id()不起作用,它返回一个空节点。解释相当复杂的设置: 我的输入(input.xml):Xml xquery fn:id不工作,即使type=xs:id似乎声明正确,xml,xslt-2.0,xpath-2.0,Xml,Xslt 2.0,Xpath 2.0,我正在使用Altova开发一个运行在服务器上的XSLT转换。我需要修改一些东西,并在本地使用Oxgen,使用saxon解析器。由于某些原因,fn:id()不起作用,它返回一个空节点。解释相当复杂的设置: 我的输入(input.xml): 真的 秘密业务 一些生意 2008 第二个输入被读入一个变量(见下文),它看起来像(ProcessData.xml): > 1234-4321-asdf .... 我的XSLT: <!-- Reading in second input (proce
真的
秘密业务
一些生意
2008
第二个输入被读入一个变量(见下文),它看起来像(ProcessData.xml):
>
1234-4321-asdf
....
我的XSLT:
<!-- Reading in second input (process information) -->
<xsl:param name="process-data-path" select="xs:string('file:///home/documents/some/path/to/ProcessData.xml')"
<xsl:variable name="process-data" select="document($process-data-path)"
<!-- get the value of element <goose:PID> that corresponds to the id in 'input.xml' -->
<xsl:variable name="pid">
<xsl:value-of select="fn:element-with-id(@id,$process-data)/goose:PID"/>
</xsl:variable>
如果要使用基于模式的ID信息,是否使用Saxon EE?您是否为Saxon EE转换场景在氧气中启用了模式验证?否则,我认为您不能利用ID
函数或具有ID
函数的元素所需的基于模式的ID值声明。如何在oxygen中为我的场景启用模式验证?请看,您需要在该对话框中启用lax
或strict
验证,您可以通过单击选择框旁边的图标打开该对话框,在该对话框中选择Saxon EE作为XSLT转换的处理器。这就成功了!谢谢。
<goose:process-data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.goose.org" xmlns:goose="http://www.goose.org" xsi:schemaLocation="http://www.goose.org ProcessData.xsd">>
<goose:Collection>
<goose:Package id="entry_1">
<goose:PID>1234-4321-asdf</goose:PID>
</goose:Package>
....
<!-- Reading in second input (process information) -->
<xsl:param name="process-data-path" select="xs:string('file:///home/documents/some/path/to/ProcessData.xml')"
<xsl:variable name="process-data" select="document($process-data-path)"
<!-- get the value of element <goose:PID> that corresponds to the id in 'input.xml' -->
<xsl:variable name="pid">
<xsl:value-of select="fn:element-with-id(@id,$process-data)/goose:PID"/>
</xsl:variable>