This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: templates with optional paramters
- From: Joerg Heinicke <joerg dot heinicke at gmx dot de>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Fri, 22 Mar 2002 11:38:31 +0100
- Subject: Re: [xsl] templates with optional paramters
- References: <200203221009.g2MA9sv31344@mailgate5.cinetic.de>
- Reply-to: xsl-list at lists dot mulberrytech dot com
<xsl:template name="foo">
<xsl:param name="bar_mandatory" select="'default'"/>
<xsl:param name="bar_optional" select="'default'"/>
<xsl:if test="$bar_optional = 'default'">
<xsl:text>$bar_optional not specified, using default
value</xsl:text>
</xsl:if>
</xsl:template>
Regards,
Joerg
robert.soesemann@web.de wrote:
> I have an xslt template with 2 paramter. One of them must not be specified.
> How can I find out if one or two params where specified? Do I need two versions of the template with mode? Or can I check with =''?
>
> <xsl:template name="foo">
> one mandatory paramter
> one optional paramter
> ...do things...
> </xsl:template>
>
> One can call it by:
>
> <xsl:call-template name="foo">
> <xsl:with-param name=="bar_mandatory" select="$whatever" />
> <xsl:with-param name="bar_optional" select="$whatever" />
> </xsl:call-template>
>
> OR
>
> <xsl:call-template name="foo">
> <xsl:with-param name=="bar_mandatory" select="$whatever" />
> </xsl:call-template>
>
>
> Rob
--
System Development
VIRBUS AG
Fon +49(0)341-979-7411
Fax +49(0)341-979-7409
joerg.heinicke@virbus.de
www.virbus.de
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list