cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Ball <ba...@webslingerZ.com>
Subject Re: Order of execution of different namespace tags when using xsp?
Date Thu, 13 Jul 2000 17:28:04 GMT
On 13 Jul 2000, Kjell M. Myksvoll wrote:

> * Donald Ball
> > what you want to do in your logicsheet is something like this:
> 
> Thanks for your reply! It gave a very informative description of how I
> can solve an another problem that I've had with applying xsp. The
> problem that I described in my previous mail is still there though...
> 
> Some more description:
> 
>  Using an explicit value works
> 
>    <ls:set-terminal-id>935235235</ls:set-terminal-id>
> 
>  The 935235235 value above are captured fine by the following
>  xsl statement
> 
>  <xsl:template match="ls:set-terminal-id">
>   <xsp:expr>_set_terminal_id("<xsl:value-of select="." />")</xsp:expr>
>  </xsl:template>
> 
>  But when using the following
> 
>    <ls:set-terminal-id><request:get-query-string /></ls:set-terminal-id>
> 
>  the xsl statment does not captures anything.

right - because you're calling value-of on this:

<ls:set-terminal-id><request:get-query-string /></ls:set-terminal-id>

which evaluates to the empty string. you need to apply-templates on the
request:get-query-string element so that it can be transformed by the
request logicsheet into this:

<xsp:expr>request.getQueryString()</xsp:expr>

my suggestion is to use the get-nested-string template i wrote you last
time like this:

<xsl:template match="ls:set-terminal-id">
 <xsl:variable name="arg">
  <xsl:call-template name="get-nested-string">
   <xsl:with-param name="content" select="."/>
  </xsl:call-template>
 </xsl:variable>
 <xsp:expr>_set_terminal_id(<xsl:copy-of select="$arg"/>)</xsp:expr>
</xsl:template>

that's a little overkill for what you're trying to do, but it should give
you the idea on how to generalize this to other situations.

- donald

ps - here's a possibly later revision of get-nested-string:

<xsl:template name="get-nested-string">
 <xsl:param name="content"/>
 ""
 <xsl:for-each select="$content/node()">
  <xsl:choose>
   <xsl:when test="name(.)">
    + <xsl:apply-templates select="."/>
   </xsl:when>
   <xsl:otherwise>
    + "<xsl:value-of select="."/>"
   </xsl:otherwise>
  </xsl:choose>
 </xsl:for-each>
</xsl:template>

also look in the sql.xsl logicsheet to see ricardo's get-nested-content
and get-nested-string methods


Mime
View raw message