Template Parameters?

Here should go questions about transforming XML with XSLT and FOP.
eXentric
Posts: 3
Joined: Wed Mar 02, 2005 12:27 am

Template Parameters?

Post by eXentric »

We have an XSLT template like this:

...
<xsl:template match="/">
<xsl:param name="FromDate"/>
<xsl:param name="ToDate"/>
...

I have specified the parameter 'FromDate' in both the Configure parameters dialog and in the Transformation scenario editor. It seems like no matter what I do, when I start debugging 'FromDate' seems undefined. Then, when the debugger steps over the template deffinition, 'FromDate' becomes defined but it's blank. The parameters I've setup are not passed to the template and I can't double-click the variable and change it while debugging either.

Am I missing something? Is this not what the parameters dialog is for?

Jared
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

Hello,

In the Configure parameters dialog you set the values of global not local stylesheet parameters. Global parameters are declared outside of any XSLT template. Values of local parameters are set when you call that template explicitly in your stylesheet with some values for the parameters.

Regards,
Sorin
eXentric
Posts: 3
Joined: Wed Mar 02, 2005 12:27 am

Post by eXentric »

Thank you for your reply Sorin. Let me clearify:

We do not call the template directly. As you see, the template matches "/", which is the entire document. The way we get our data transformed is using the .Net framework. Specifically, the XslTransform.Transform method.

This method passes the parameters as an XsltArgumentList, and therefore we're passing the parameters in code and completely outside of the stylesheet.

Is there any way to reproduce this functionality in Oxygen? Or can you suggest another way of debugging?
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi Jared,

What you need is to have global parameters. So instead of

...
<xsl:template match="/">
<xsl:param name="FromDate"/>
<xsl:param name="ToDate"/>
...

you need

...
<xsl:param name="FromDate"/>
<xsl:param name="ToDate"/>
...
<xsl:template match="/">
...

and then the parameters defined in oXygen in the Configure parameters dialog will be seen by your stylesheet.

Best Regards,
George
eXentric
Posts: 3
Joined: Wed Mar 02, 2005 12:27 am

Post by eXentric »

Thank you george for your reply, that does work for us. I realize that was probably a fundimental lack of understanding on our part of how it's supposed to work outside of the .Net environment.
Post Reply