xsl-list
[Top] [All Lists]

RE: [xsl] Shorthand.

2007-07-25 10:09:00
I just noticed the OP is selecting the string 'x' and the string 'y' and
has the param and with-param backwards in the example. You call a
template *with* a param and the named template *has* a param. 

I'm sure this was just a typo in trying to provide an example, but could
give a newbie some debugging frustration if not... 


Thanks!
Angela 

-----Original Message-----
From: Andrew Welch [mailto:andrew(_dot_)j(_dot_)welch(_at_)gmail(_dot_)com] 
Sent: Wednesday, July 25, 2007 11:58 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Shorthand.

On 7/25/07, Steve <subsume(_at_)gmail(_dot_)com> wrote:
Hey there, I have a template for creating ajax links:

<xsl:template name="a">
        <xsl:with-param name="href" />
        <xsl:with-param name="text" />
        <a href="{$href}" onClick="showData('{$href}');return
false;"><xsl:value-of select="$text" /></a> </xsl:template>

is there some shorter way to use this (XSL 1.0) template than...

<xsl:call-template name="a">
   <xs:param name="href" select="'x'"/>
   <xs:param name="text" select="'y'"/> </xsl:call-template>

It depends...

If x and y are selected from the current node, then you can just go:

<xsl:call-template name="a"/>

and

<xsl:template name="a">
  <a href="{(_at_)x}" .....>
    <xsl:value-of select="y"/>
  </a>
</xsl:template>

...as the current node is the same within the named template as it is
when you call the named template.

(if not then that's the correct way.)

cheers
andrew
--
http://andrewjwelch.com

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>