On 09 Mar 2009, at 14:30, Bernmeister wrote:

Hi

Is there a way via Java to set an attribute at run time?

For example, in my XSLT file:

<fo:layout-master-set>
   <fo:simple-page-master master-name="A4" page-height="29.7cm"
page-width="21cm">
       ...snip...
   </fo:simple-page-master>
</fo:layout-master-set>

Can I set the value for page-height (or any attribute) via Java code?

Not sure if
transformer.setOutputProperty( "page-height", "29.7cm"
);

or

transformer.setParameter( "page-height", "29.7cm" );

will do the trick - but then how do I relate the variable in Java back in
XSLT?

This could work, but then you have to have something like the following in your stylesheet:

[as child of the xsl:stylesheet]
<xsl:param name="page-height" value="297mm" />
(the value here will be the default, in case you don't set it explicitly)

[in the template where you define your fo:simple-page-master]
<fo:simple-page-master master-name="A4" page-height="{$page- height}" ...>


HTH!

Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to