Hi,

I am able to replace attributes in my XSLT file via Java.  To replace

    page-height="297mm"

with 

    page-height="{$page-height}"

in my Java I would do this:

    transformer.setParameter( "page-height", "297mm" );

However, is it possible to replace the argument for an 'if' test?  

For example, say I have:

    <xsl:if test="fruit='apple'">
        ...snip...
    </xsl:if>

then the contents will be rendered/processed if my XML data file contains a
section where fruit = apple.

What I want to do is pass 'apple' via Java, because it may not always be
'apple' that I want to test.

I have found that if I have in my Java

    transformer.setParameter( "fruit-name", "apple" );

and my XSLT

    <xsl:if test="fruit={$fruit-name}">
        ...snip...
    </xsl:if>

the test fails.  It's possible that I may have to single quote the "apple"
passed in via Java to look like "'apple'" but no go.  I have also tried
passing in the whole test line:

    transformer.setParameter( "fruit-test", "name='apple'" );

and

    <xsl:if test="{$fruit-test}">
        ...snip...
    </xsl:if>

But still no go.

Any ideas?  Is it possible to see/output the XSLT after FOP has done the
parameter substitution?


Thanks in advance,

Bernmeister.
-- 
View this message in context: 
http://www.nabble.com/Dynamically-replace-argument-for-%27if%27-test-tp22523185p22523185.html
Sent from the FOP - Users mailing list archive at Nabble.com.


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

Reply via email to