|
Subject: Re: [xsl] forwarding only existing parameter From: Tony Graham <Tony.Graham@xxxxxxxxxxxxxxx> Date: Mon, 17 Sep 2001 14:00:17 +0100 |
Guillaume Rousse wrote at 17 Sep 2001 14:16:47 +0200:
...
> Cause i have the following structure
>
> <template name="list-item">
> <param name="context">
>
> <li>
> <apply-template select=".">
> <with-param name="context" select="$context"/>
> <apply-template/>
> </li>
> </template>
>
> <template match="specific-item1">
> <param name="context">default value</param>
>
> [..]
> </template>
>
> When calling list-item template with a context parameter, it get forwarded to
> template specific-item1. But when calling list-item template without this
> parameter, it forwards an empty context parameter to template specific-item1,
> thus preventing default value use :-(
Try:
<template name="list-item">
<param name="context" select="false()">
<li>
<apply-template select=".">
<with-param name="context" select="$context"/>
<apply-template/>
</li>
</template>
<template match="specific-item1">
<param name="context"/>
<variable name="real-context">
<choose>
<when test="$context">
<value-of select="$context"/>
</when>
<otherwise>default value</otherwise>
</choose>
</variable>
[..]
</template>
Regards,
Tony Graham
------------------------------------------------------------------------
XML Technology Center - Dublin mailto:tony.graham@xxxxxxxxxxxxxxx
Sun Microsystems Ireland Ltd Phone: +353 1 8199708
Hamilton House, East Point Business Park, Dublin 3 x(70)19708
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] forwarding only existing , Guillaume Rousse | Thread | Re: [xsl] forwarding only existing , Guillaume Rousse |
| RE: [xsl] exclude-result-prefixes, Dmitri Ilyin | Date | Re: [xsl] forwarding only existing , David Carlisle |
| Month |