问题描述
我有一个带有两个累加器的流式XSLT。一个是流式的,另一个不是。不可流式累积器(投票)将仅与(通过copy-of
复制的项目中的项匹配,因此应允许在其accumulator-rule
中进行一些导航。但是,出现以下错误:
net.sf.saxon.trans.XPathException: Navigation using child axis is not supported from a streamed input node
我的样式表如下:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:cdf="http://itl.nist.gov/ns/voting/1500-103/v1" xmlns:saxon="http://saxon.sf.net/" xmlns:map="http://www.w3.org/2005/xpath-functions/map" exclude-result-prefixes="xs" version="3.0">
<xsl:mode streamable="yes" use-accumulators="#all"/>
<xsl:mode name="nostream" streamable="no" />
<!-- stores content about the election,assumes there is 1 -->
<xsl:accumulator name="Election" initial-value="1" streamable="yes">
<xsl:accumulator-rule match="cdf:Election" select="." saxon:capture="yes" phase="end"/>
</xsl:accumulator>
<!-- holds Votes,one for each contestselection in election -->
<xsl:accumulator name="Votes" streamable="no" initial-value="map {}" as="map(xs:string,xs:integer?)">
<!-- sets initial value,+ on null doesn't work! -->
<xsl:accumulator-rule match="cdf:ContestSelection" select="map:put($value,@ObjectId,0)"/>
<xsl:accumulator-rule match="cdf:SelectionPosition" select="map:put($value,../cdf:ContestSelectionId,map:get($value,../cdf:ContestSelectionId) + 5)"/>
</xsl:accumulator>
<xsl:template match="/">
<xsl:apply-templates select="cdf:CastVoteRecordReport/cdf:CVR/copy-of(.)" mode="nostream" />
<xsl:variable name="Votes" select="accumulator-after('Votes')"/>
<xsl:apply-templates select="accumulator-after('Election')" mode="report"/>
</xsl:template>
...
</xsl:stylesheet>
我需要导航才能在Votes
中设置地图键的值。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)