Re: [xsl] Kosher XSLT 3.0 numbering solution?

Subject: Re: [xsl] Kosher XSLT 3.0 numbering solution?
From: "Liam R. E. Quin liam@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 1 Sep 2016 15:27:04 -0000
On Thu, 2016-09-01 at 13:51 +0000, David Sewell dsewell@xxxxxxxxxxxx
wrote:
>B 
> B B B <xsl:variable name="bodyPageNo" select="0" as="xs:integer"
> saxon:assignable="yes"/>
> B B B <xsl:template match="pb">
> B B B B B <xsl:variable name="pageNumber">
> B B B B B B B B <saxon:assign name="bodyPageNo" select="
> B B B B B B B B B B B if (@n) then xs:integer(@n) else $bodyPageNo + 1
> B B B B B B B B B B B "/>
> B B B B B B B B <xsl:value-of select="$bodyPageNo"/>
> B B B B B </xsl:variable>

But surely it's not that hard to write a recursive template or function
that finds the previous page break and adds one to it where needed?
Roughly,

If this is the first page number then (@n, 1)[1]
If @n is supplied then @n
Otherwise 1 + pagenumber( (preceding::pagebreak)[1] )

If performance is an issue you can ask saxon to memoize (remember) the
function results.

Liam

Current Thread