I am trying to get multiple page orientation according to a generated XML definition with a pageTemplate that can take either the Landscape
or Portrait
value:
<report>
<config>
<pageTemplate>Landscape</pageTemplate>
...
Then I pass the pageTemplate
value in my_report.xsl
file:
<xsl:template match="config"> <xsl:attribute name="firstPageTemplate"><xsl:value-of select="pageTemplate"/></xsl:attribute> ... </xsl:template>
or
<xsl:template match="product_template">
<setNextTemplate>
<xsl:attribute name="name"><xsl:value-of select="//report/config/pageTemplate"/></xsl:attribute>
</setNextTemplate>
<xsl:apply-templates select="data"/>
</xsl:template>
With the different pageTemplate definitions in the custom_rml.xsl
file:
<xsl:template name="rml">
<document filename="example.pdf">
<template>
<pageTemplate id="Landscape" pageSize="(29.7cm, 21cm)">
<frame id="main" x1="0cm" y1="1cm" width="25.0cm" height="19cm"/>
</pageTemplate>
<pageTemplate id="Portrait" pageSize="(21cm, 29.7cm)" leftMargin="2.0cm" >
<frame id="main" x1="2cm" y1="1cm" width="19.0cm" height="25cm"/>
</pageTemplate>
</template>
...
The Frame definition works well according to the pageTemplate defined in the xml as portrait or landscape. However I still could not get the pageSize working properly. What could be wrong in the above code?
I tried either pageSize and pagesize. Anyway both are working when placed directly in the template definition like:
<template pageSize="(21cm, 29.7cm)">
but how to change this orientation from the xml definition? It may exist other-ways to do that...
Any suggestions are welcome!