|
Subject: RE: [xsl] Conditional with-param From: "M. David Peterson" <m.david@xxxxxxxxxx> Date: Sun, 23 May 2004 08:24:22 -0600 |
Hi Marco,
Without understanding exactly what it is you are trying to accomplish
the easiest way to solve your particular dilemma is to create a variable
outside of the xsl:apply-templates element that uses conditional logic
to determines its value. Also, to ensure that you only get one matching
value I would use an xsl:choose block to determine the value of the
variable. For example:
<xsl:variable name="foo">
<xsl:choose>
<xsl:when test="condition1">
...value if condition1 is true
</xsl:when>
<xsl:otherwise>
...value if condition1 is not true
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:apply-templates select="/foo/bar">
<xsl:with-param name="foo" select="$foo"/>
</xsl:apply-templates>
Within your matching template you would need to create a parameter
called 'foo' that would hold the value passed to it using xsl:with-param
and having the same name.
Hope this helps!
<M:D/>
> -----Original Message-----
> From: Marco [mailto:brbromo@xxxxxx]
> Sent: Thursday, May 20, 2004 7:35 AM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Conditional with-param
>
> Is it possible to do something like
>
> <xsl:apply-templates>
> <xsl:if select="condition1">
> <xsl:with-param name="myparam1">
> </xsl:if>
> <xsl:if select="condition2">
> <xsl:with-param name="myparam2">
> </xsl:if>
> </xsl:apply-templates>
>
> or should I write a four-cases choose instruction, with four different
> options combinations?
>
> Marco
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] Conditional with-param, Marco | Thread | Re: [xsl] Conditional with-param, Brian Chrisman |
| RE: [xsl] SELECT ALL CHILD NODES AN, Michael Kay | Date | RE: [xsl] Nodesets handling (gettin, M. David Peterson |
| Month |