Yeah, I found that too. Thanks Timothy. Apparently you can specify the presence of a param without a default value as well:

<xsl:param name="inApp"/>

- Bradley

On Oct 3, 2008, at 7:40 PM, Timothy Jones wrote:

Hi Bradley...

I was under the impression that you had to pass them along with each template, starting with the <xsl:template match='/'> tag, and pass them to the other templates that need them like this:

   <xsl:apply-templates select='node-spec'>
      <xsl:with-param name='key' select='value' />
<!-- note the "with-". This is different tag than the <xsl:param> that you use in an <xsl:template>. -->
   </xsl:apply-templates>

in a similar fashion to how you might add an argument to a bunch of methods in order to get them to the methods that need them.

But when I looked up the spec earlier (hoping to help), I noticed that you can place a <xsl:param> tag in a global context at the top of the stylesheet (outside of any <xsl:template> tag. Look at Listing 2 in http://www.ibm.com/developerworks/xml/library/x-tipxsltrun/index.html for an example.

Fortunately, each param has a name, which means the physical order of the param tags doesn't matter. Nice!

Now I realize that my initial statement in this post about where you have to put param tags is probably excessive. I just wanted to pipe up and let you know about the global declaration method, while I go back and see what is actually necessary. (I'm no big expert, I just have used XSL in a few server-side Java apps over the years).



tlj

Timothy  Jones
personal email: [EMAIL PROTECTED]
From: Bradley Wagner [mailto:[EMAIL PROTECTED]
Sent: Friday, October 03, 2008 6:57 PM
To: [EMAIL PROTECTED]
Cc: xalan-j-users@xml.apache.org
Subject: Re: Validating XSLT by building a Templates or Transformer obje

Was looking online for where to do this exactly. Is it just:

<xsl:param name="inApp">no</xsl:param>

where I declare the parameter with a default value? Is there a way to just declare that a parameter will exist (will be supplied) but is not set?

On Oct 2, 2008, at 7:48 PM, [EMAIL PROTECTED] wrote:


You haven't declared your stylesheet parameter in the XSLT. Fix that and see where it gets you.

______________________________________
"... Three things see no end: A loop with exit code done wrong,
A semaphore untested, And the change that comes along. ..."
-- "Threes" Rev 1.1 - Duane Elms / Leslie Fish (http://www.ovff.org/pegasus/songs/threes-rev-11.html )


Reply via email to