[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: accumulators and continuous numbering

Subject: Re: accumulators and continuous numbering
From: "Graydon graydon@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 18 Oct 2019 20:41:58 -0000
Re:  accumulators and continuous numbering
On Fri, Oct 18, 2019 at 08:21:28PM -0000, Martin Honnen martin.honnen@xxxxxx scripsit:
> On 18.10.2019 21:08, Graydon graydon@xxxxxxxxx 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" />
> </xsl:variable>
> 
> 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:apply-templates>
>               <xsl:with-param name="sum" tunnel="yes" select="$sum"/>
>           </xsl:apply-templates>
>           <xsl:next-iteration>
>               <xsl:with-param name="sum" select="$sum +
> accumulator-after('acc-example')"/>
>           </xsl:next-iteration>
>       </xsl:iterate>
>   </xsl:variable>
> 
> Not sure whether that is anything better, it seems to be a bit too
> complicated.

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!
Graydon

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.