You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Bernmeister <th...@hotmail.com> on 2009/03/09 14:30:22 UTC
How to dynamically replace attributes such as
simple-page-master::page-width?
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?
Thanks in advance,
Bernmeister.
--
View this message in context: http://www.nabble.com/How-to-dynamically-replace-attributes-such-as-simple-page-master%3A%3Apage-width--tp22413165p22413165.html
Sent from the FOP - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: How to dynamically replace attributes such as
simple-page-master::page-width?
Posted by Bernmeister <th...@hotmail.com>.
Bingo!
Thanks very much for the speedy and helpful answer!
--
View this message in context: http://www.nabble.com/How-to-dynamically-replace-attributes-such-as-simple-page-master%3A%3Apage-width--tp22413165p22423381.html
Sent from the FOP - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: How to dynamically replace attributes such as simple-page-master::page-width?
Posted by Andreas Delmelle <an...@telenet.be>.
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: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org