|
Subject: [xsl] Problem with conditional parameter in call-template From: "Carlos Fragoso Mariscal" <cfragoso@xxxxxxxx> Date: Tue, 4 Sep 2001 03:47:35 +0200 |
Hi again,
Thank you to all of those who answered my
previos questions,my greetings goes to them.
I'm simplifying my xsl code and I faced a
problem. I can't put <xsl:choose> either
<xsl:if> elements inside a <xsl:call-template>
so there is a parameter (the one called tipus)
that should be password when the name of the
node is contrasenya and that should be text
when the node has another name.
Now I have faced the problem doing a when,
otherwise structure that doubles the amount
of code where only the tipus parameter is
different.
<xsl:choose>
<xsl:when test="name(.)='contrasenya'">
<xsl:call-template name='entradaTexte'>
<xsl:with-param name='id'>
<xsl:value-of select='@id'/>
</xsl:with-param>
<xsl:with-param name='valor'>
<xsl:value-of select='valor'/>
</xsl:with-param>
<xsl:with-param name='tipus'>
<xsl:text>password</xsl:text>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name='entradaTexte'>
<xsl:with-param name='id'>
<xsl:value-of select='@id'/>
</xsl:with-param>
<xsl:with-param name='valor'>
<xsl:value-of select='valor'/>
</xsl:with-param>
<xsl:with-param name='tipus'>
<xsl:text>text</xsl:text>
</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
The template called has got the default value for
the paremeter tipus to text so in the otherwise
body I could delete the with-param tag for
parameter tipus.
<xsl:template name='entradaTexte'>
<xsl:param name='tipus'>text</xsl:param>
<xsl:element name='input'>
<xsl:attribute name='type'><xsl:value-of
select='$tipus'/></xsl:attribute>
<xsl:attribute name='name'><xsl:value-of
select='$id'/></xsl:attribute>
<xsl:attribute name='valor'><xsl:value-of
select='$valor'/></xsl:attribute>
</xsl:element>
</xsl:template>
Any idea to do only one call-template
having that conditional parameter?
(in this case is only two values but it
could have more so code will grow up fast)
Thank you in advance!!! :)
---------------------------
Carles Fragoso i Mariscal
Supercomputing Center of Catalonia
Communications & Operations Dept.
E-Mail: <cfragoso@xxxxxxxx>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Can FOP output pdf file f, Ser Siew Keok | Thread | Re: [xsl] Problem with conditional , Gavin Corfield |
| [xsl] Can FOP output pdf file from , Ser Siew Keok | Date | Re: [xsl] Problem with conditional , Gavin Corfield |
| Month |