On onsdag 7. juli 2004, 18:41, Michael A Nachbaur wrote:
> > But then, I need to test whether a parameter exists... In XSP
> > that's straightforward, thanks to the many good taglibs, but I
> > haven't found anything on checking the parameters in XSLT, is it
> > doable?
>
> Well, the most common method I know of doing that is:
>
> <xsl:param name="foo" select="''"/>

Is that line really necessary....?

> <xsl:if test="$foo = ''">
>   <!-- Test to see if no value has been supplied -->
> </xsl:if>
> <xsl:if test="not($foo = '')">
>   <!-- Test to see if a value has been supplied -->
> </xsl:if>

Yhm, yes of course... The reason why I first thought this was inadequate 
was that it checks for an empty string rather than a non-existant 
variable. Which would make a situation where I want to delete a string 
harder to work with. But since you say it, of course, the query 
parameters are not making that distinction, a parameter is passed on 
from a request even if the field wasn't given a value. Which means I 
would have to work around the around problem anyway. So thanks! 

> You can probably clean this up a bit by using named templates.
>
> <xsl:template name="param.foo">
>     <xsl:choose>
>         <xsl:when test="$foo = ''">
>             <xsl:value-of select="$foo"/>
>         </xsl:when>
>         <xsl:otherwise>
>             <xsl:value-of select="foo"/>
>         </xsl:otherwise>
>     </xsl:choose>
> </xsl:template>

Yup, nice!

> > Is there more documentation on the parameters AxKit pass to XSLT
> > somewhere now? I remembered an old thread about them and found it
> > in the archives, but that was about all.
>
> IIRC, by default it adds the query string parameters supplied to the
> URL, and any additional parameters added by any AxKit plugins that
> are supplied.  For instance, you can use one of the
> Apache::AxKit::Plugin::AddXSLParams::* modules to put in additional
> parameters as needed.

Yup, but things like if a <xsl:param name="foo" select="''"/> "variable 
declaration" is really necessary is rather unclear... 

> Kip wrote a module to parse out the HTTP Request object and supply
> detailed parameters for them (::Request) and I have a module that can
> take values stored in your BasicSession and supply them to your
> stylesheet.

Yup!

> > Kip, anything about that in your new book? It's in the mail on its
> > way here... :-)
>
> Good choice!  Its a really great book.  I've been an AxKit regular
> for a while now, and I've learned quite a few things in there.

Good!

> http://nachbaur.com/pgpkey.asc

Uhm, you didn't get the new key right, but I'll take that in a private 
e-mail. :-) 

Best,

Kjetil
-- 
Kjetil Kjernsmo
Astrophysicist/IT Consultant/Skeptic/Ski-orienteer/Orienteer/Mountaineer
[EMAIL PROTECTED]  [EMAIL PROTECTED]  [EMAIL PROTECTED]
Homepage: http://www.kjetil.kjernsmo.net/        OpenPGP KeyID: 6A6A0BBC

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to