cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylvain.wal...@anyware-tech.com>
Subject Re: <xsl:template name="value-for-..."> buggy ??
Date Wed, 17 Oct 2001 05:53:12 GMT


Martin Man a écrit :
> 
> hi team,
>         when looking around several logicsheets I found this code
> 
>   <xsl:template name="value-for-name">
>     <xsl:choose>
>       <xsl:when test="@name">"<xsl:value-of select="@name"/>"</xsl:when>
> 
>       <xsl:when test="name">
>                       ^^^^
> 
>         <xsl:call-template name="get-nested-content">
>           <xsl:with-param name="content" select="xsp-request:name"/>
>                                                  ^^^^^^^^^^^^^^^^
> 
>         </xsl:call-template>
>       </xsl:when>
>     </xsl:choose>
>   </xsl:template>
> 
> don't you think it will not work at all ??? (tho, me not a namespace guru :-()
> 
> rgds,
> martin
> 
> P.S. i'm willing to fix them all, just to be sure i'll not break anything
> 

I'm afraid you will ;)

This kind of templates allow for a dual notation of logicsheet tag
parameters : either as attribute for constant values of as child element
for dynamic values.

Thus, the two notations below are equivalent :
  <xsp-request:get-attribute name="foo"/>
and
  <xsp-request:get-attribute>
    <xsp-request:name>foo</xsp-request:name>
  </xsp-request:get-attribute>

But the second one also allows constructs like :
  <xsp-request:get-attribute>
   
<xsp-request:name><xsp:expr>getParameterName()</xsp:expr></xsp-request:name>
  </xsp-request:get-attribute>

You will find in logicsheet-utils.xsl some generic templates that
automate this stuff and avoid all that copy/paste in every logicsheet.
For now it's used only by the capture logicsheet (capture.xsl), but if
you like to use it more widely, go on !

Sylvain.
-- 
Sylvain Wallez
Anyware Technologies - http://www.anyware-tech.com

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message