I would like to create a static-content using a template call. Each of my elements has an attribute "pagemaster" that has exactly the name of one of my declared simple-page-master master names. Based on this attribute I decide which simple-page-master is used for each element. Now I would also like to use this attribute to determine which static-content should be rendered on the page.
My previous consideration is as follows:
<fo:layout-master-set>
.
.
.
</fo:layout-master-set>
<xsl:for-each-group select=".//reportelements/*[pagemaster != '']" group-adjacent="pagemaster">
<fo:page-sequence master-reference="{current-grouping-key()}">
<!-- Here is my Problem. This should call the Template below -->
<!-- What i want to achieve is that if "{current-grouping-key()}" is "TITLEPAGE" then the Template below gets called -->
<xsl:call-template name="{current-grouping-key()}"/>
<fo:flow flow-name="xsl-region-body">
<xsl:for-each select="current-group()">
<xsl:apply-templates select="."/>
</xsl:for-each>
</fo:flow>
</fo:page-sequence>
</xsl:for-each-group>
</fo:root>
</xsl:template>
<xsl:template name="TITLEPAGE">
<fo:static-content flow-name="xsl-region-after">
<fo:block text-align="right">
<fo:external-graphic src="url(file:C:\Logo.pdf)" content-width="6cm"/>
</fo:block>
</fo:static-content>
</xsl:template>
The problem i have now is that i get the following Error:
Static error in xsl:call-template/@name on line 59 column 73 of masterpage_report.xsl:
XTSE0020: Invalid QName {{current-grouping-key()}}
Untested, but you could replace the xsl:call-template
with an xsl:apply-templates
to process the pagemaster element in a 'static-content' mode:
<xsl:apply-templates select="pagemaster" mode="static-content" />
The @match
attributes of templates in the 'static-content' mode would include a predicate that ensures that the template for the pagemaster
value is the one that is processed:
<xsl:template match="pagemaster[. = 'TITLEPAGE']"
mode="static-content">
<fo:static-content flow-name="xsl-region-after">
<fo:block text-align="right">
<fo:external-graphic src="url(file:C:\Logo.pdf)" content-width="6cm"/>
</fo:block>
</fo:static-content>
</xsl:template>
If you are not otherwise processing pagemaster
elements, then you might not even need the separate mode.