如何使用xslt在报表最后一页打印运行总计?

问题描述 投票:0回答:1
xml xslt count
1个回答
0
投票

评论中建议使用的示例

for-each-group

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="3.0"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  exclude-result-prefixes="#all"
  expand-text="yes">
  
  <xsl:output indent="yes"/>
  
  <xsl:template match="root">
    <xsl:copy>
      <xsl:for-each-group select="item" group-adjacent="(position() - 1) idiv 19">
        <page count="{position()}" is-last-page="{position() eq last()}">
          <xsl:apply-templates select="current-group()"/>
        </page>
      </xsl:for-each-group>
    </xsl:copy>
  </xsl:template>

  <xsl:mode on-no-match="shallow-copy"/>
  
</xsl:stylesheet>

小提琴示例

对于 XSLT 2 处理器,分组是相同的,用身份转换模板替换声明性

xsl:mode
声明

© www.soinside.com 2019 - 2024. All rights reserved.