-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On July 7, 2004 07:56 am, Kjetil Kjernsmo wrote:
> But this is of little use, because I'd like to have a single template
> replacing all the possible parameters, so instead of $title, I should
> use the
> @name
> (i.e. the name attribute of the val:insert element), to identify the
> parameter. That's a pure XSLT/XQuery question I guess, but I might as
> well ask: Any ideas on how to do that?
>
> 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="''"/>
....
<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>

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>

> 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.

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.

> 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.

- -- 
Michael A. Nachbaur <[EMAIL PROTECTED]>
http://nachbaur.com/pgpkey.asc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFA7Ce5Qy51zN2518IRAuYsAJ0fcK4uz+EXyyNTdFgdVNv+HaGLWACdFmIJ
hEVAbuiWrcH45dqYRHa/ng4=
=QWDn
-----END PGP SIGNATURE-----

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

Reply via email to