[Top] [All Lists]

Re: [xsl] accumulators and continuous numbering

2019-10-18 15:42:03
On Fri, Oct 18, 2019 at 08:21:28PM -0000, Martin Honnen 
martin(_dot_)honnen(_at_)gmx(_dot_)de scripsit:
On 18.10.2019 21:08, Graydon graydon(_at_)marost(_dot_)ca wrote:
Is there a better way to get the single continuous sequence of numbers?

If don't want to create a result tree then I think instead of

<xsl:variable as="element(w:document)+" name="numberedSrc">
 <xsl:apply-templates mode="fileNumber" select="$contentSet" />

you would need to use xsl:iterate select="$contentSet" and pass the
latest accumulator on as the parameter of xsl:iterate, like I have done
in https://xsltfiddle.liberty-development.net/bwdwrT

  <xsl:variable name="transformed-docs" as="element(root)*">
      <xsl:iterate select="$docs">
          <xsl:param name="sum" as="xs:integer" select="0"/>
              <xsl:with-param name="sum" tunnel="yes" select="$sum"/>
              <xsl:with-param name="sum" select="$sum +

Not sure whether that is anything better, it seems to be a bit too

Given the size of what I've got, I'll stick with "let's throw the lot in
a container element", but good to have a "by the each" example available.

Thank you!
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com

<Prev in Thread] Current Thread [Next in Thread>