You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Martin Man <Ma...@seznam.cz> on 2001/10/16 15:10:33 UTC

buggy ??

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


-- 
2CC0 4AF6 92DA 5CBF 5F09  7BCB 6202 7024 6E06 0223

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


Re: buggy ??

Posted by Martin Man <Ma...@seznam.cz>.
On Wed, Oct 17, 2001 at 12:03:14PM +0200, Sylvain Wallez wrote:
> 
> 
> Martin Man a écrit :
> <snip/>
> 
> Doh ! You're absolutely right ! I wasn't fully awaken this morning when
> I checked the stylesheets ;)
> The right test is effectively <xsl:when test="xsp-request:name">

cool, now going to take a lunch, and then I'll check this common misspelling
and try to fix them...

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

martin
-- 
2CC0 4AF6 92DA 5CBF 5F09  7BCB 6202 7024 6E06 0223

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


Re: buggy ??

Posted by Sylvain Wallez <sy...@anyware-tech.com>.

Martin Man a écrit :
> 
> On Wed, Oct 17, 2001 at 07:53:12AM +0200, Sylvain Wallez wrote:
> >
> >
> > 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.
> 
> sure I know all this, the keypoint was that attributes work correctly, but
> when child node is present there are constructs like
> 
> > >       <xsl:when test="@name">"<xsl:value-of select="@name"/>"</xsl:when>
> ok, this one catches attribute, no problem here...
> 
> > >       <xsl:when test="name">
> > >                       ^^^^
> this one is testing presence of child element called name (IMO wrong test,
> should test for xsp-request:name)
> 
> > >         <xsl:call-template name="get-nested-content">
> > >           <xsl:with-param name="content" select="xsp-request:name"/>
> > >                                                  ^^^^^^^^^^^^^^^^
> and here we invoke the template get-nested-content, *but* with select for
> xsp-request:name, ....
> > >
> > >         </xsl:call-template>
> 
> see my point ???
> 
> >
> > Sylvain.
> > --
> > Sylvain Wallez
> > Anyware Technologies - http://www.anyware-tech.com
> >
> 
> cau,
> martin

Doh ! You're absolutely right ! I wasn't fully awaken this morning when
I checked the stylesheets ;)
The right test is effectively <xsl:when test="xsp-request:name">

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


Re: buggy ??

Posted by Martin Man <Ma...@seznam.cz>.
On Wed, Oct 17, 2001 at 07:53:12AM +0200, Sylvain Wallez wrote:
> 
> 
> 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.

sure I know all this, the keypoint was that attributes work correctly, but
when child node is present there are constructs like

> >       <xsl:when test="@name">"<xsl:value-of select="@name"/>"</xsl:when>
ok, this one catches attribute, no problem here...

> >       <xsl:when test="name">
> >                       ^^^^
this one is testing presence of child element called name (IMO wrong test,
should test for xsp-request:name)

> >         <xsl:call-template name="get-nested-content">
> >           <xsl:with-param name="content" select="xsp-request:name"/>
> >                                                  ^^^^^^^^^^^^^^^^
and here we invoke the template get-nested-content, *but* with select for
xsp-request:name, ....
> > 
> >         </xsl:call-template>

see my point ???

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

cau,
martin

-- 
2CC0 4AF6 92DA 5CBF 5F09  7BCB 6202 7024 6E06 0223

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


Re: buggy ??

Posted by Sylvain Wallez <sy...@anyware-tech.com>.

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