错误 : "An accumulator rule that matches attribute or namespace nodes has no effect"



这是我的数据

<ECC>
<Grp EId="2123" CC="1"/>
<Grp EId="4345" CC="1"/>
<Grp EId="1074" CC="2"/>
<Grp EId="1254" CC="1"/>
<Grp EId="1342" CC="3"/>
<Grp EId="1261" CC="1"/>
</ECC>

我正在尝试使用它将其加载到累加器中

<xsl:accumulator name="CurrentLookupValue" as="xs:string" initial-value="''" streamable="yes">
<xsl:accumulator-rule match="ECC/Grp/@EId/text()" select="."/>
</xsl:accumulator>
<xsl:accumulator name="EmplIDLookup" as="map(xs:string,xs:decimal)" initial-value="map{}"
streamable="yes">
<xsl:accumulator-rule match="ECC/Grp/@CC/text()"
select="map:put($value, accumulator-before('CurrentLookupValue'), xs:decimal(.))"/>
</xsl:accumulator>

我收到警告"与属性或命名空间节点匹配的累加器规则不起作用">

文档说"定义累加器规则适用的节点集的模式" 是否有使用属性的解决方法? 还是应该在节点中创建此 xml?

@EId/text()

没有任何意义,因为属性节点没有任何子节点。

一般来说,即使使用流式处理,您也可以在元素节点上匹配时读出属性,我认为您只是想要

<xsl:accumulator name="CurrentLookupValue" as="xs:string" initial-value="''" streamable="yes">
<xsl:accumulator-rule match="ECC/Grp" select="string(@EId)"/>
</xsl:accumulator>

<xsl:accumulator name="EmplIDLookup" as="map(xs:string,xs:decimal)" initial-value="map{}"
streamable="yes">
<xsl:accumulator-rule match="ECC/Grp"
select="map:put($value, accumulator-before('CurrentLookupValue'), xs:decimal(@CC))"/>
</xsl:accumulator>

或只是一个累加器

<xsl:accumulator name="EmplIDLookup" as="map(xs:string,xs:decimal)" initial-value="map{}"
streamable="yes">
<xsl:accumulator-rule match="ECC/Grp"
select="map:put($value, string(@EId), xs:decimal(@CC))"/>
</xsl:accumulator>

相关内容

最新更新