[英]XSLT accumulator: How can you accumulate reference to elements
I have a number of elements I want to accumulate reference to and then at some point to present everyone one after the other.我有很多元素要积累参考,然后在某个时候一个接一个地呈现给大家。 I tried the next option, but it only accumulates the value and not the element itself including all its atribiotics and text ..我尝试了下一个选项,但它只累积值而不是元素本身,包括它所有的 atribiotics 和文本..
The accumulator:蓄能器:
<xsl:output omit-xml-declaration="no" indent="yes"/> <xsl:accumulator name="authorialNote_accumulator" as="xs:string*" initial-value="()"> <xsl:accumulator-rule match="authorialNote" select="$value, @marker || ."/> <xsl:accumulator-rule match="eop" select="()" phase="end"/> </xsl:accumulator>
The template:模板:
<xsl:template match="eop" > <xsl:variable name="_authorialNote" select="accumulator-before('authorialNote_accumulator')"/> <div class="authorial-note"> <xsl:for-each select="$_authorialNote"> <div eId="@eId"> <xsl:value-of select="."/> </div> </xsl:for-each> </div> </xsl:template>
Someone has an idea how to do this有人知道如何做到这一点
If you want to store an element node sequence then you need eg如果要存储元素节点序列,则需要例如
<xsl:accumulator name="authorialNote_accumulator" as="element()*" initial-value="()">
<xsl:accumulator-rule match="authorialNote" select="$value, ."/>
<xsl:accumulator-rule match="eop" select="()" phase="end"/>
</xsl:accumulator>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.