I was instructed to assemble a book (using XSL FO) from several XML files, now I'm trying to count the numbers in this book (simple numbering, without resetting in chapters, etc.), my naive approach was to do this
<xsl:template match="figure"> <fo:block xsl:use-attribute-sets="figure"> .. stuff to deal with images .. <fo:block xsl:use-attribute-sets="figure-caption"> Figure <xsl:number level="any"/>: <xsl:apply-templates/> </fo:block> <fo:block xsl:use-attribute-sets="figure-caption"> </xsl:template>
I have a composite XML file that selects files that are used with the document() function, for example:
<xsl:template match="include"> <xsl:apply-templates select="document(@src)"/> </xsl:template>
Now my problem is that number apparently always only considers instances in the current file, which is not what I want (currently there is only one or two images per file, resulting in all numbers being equal "Figure 1 'or' Figure 2 ').
I looked at two approaches, both essentially two-pass XSLTs. First, a simple approach, create intermediate XML containing the entire book using an identity transformation, which I am reluctant to do for other reasons.
Secondly, using the node-set() extension, which I tried as
<xsl:template match="include"> <xsl:apply-templates select="ext:node-set(document(@src))"/> </xsl:template>
but it gave the same result.
Any ideas? Perhaps something that is not a two-pass transformation? Any help would be greatly appreciated.
xslt multiple-files
falstro
source share