Re: [xsl] Conditional with-param

Subject: Re: [xsl] Conditional with-param
From: Brian Chrisman <brian.chrisman@xxxxxx>
Date: Mon, 24 May 2004 11:58:09 -0700
Marco wrote:

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>


I'm not sure what you are trying to do here.. but is it possible that instead of having a conditional test and passing in a param, you instead have two templates <xsl:template match="...."> which distinguish between the two different cases in the conditional?


At that point, you could just pass both myparam1 and myparam2, (if still necessary) without the conditional.

More info on the goal would probably help... but generally I'd suspect using apply-templates select="..." and xsl:template match="..." will do what you need.


That said, I believe what you are trying to do there is out of spec: (ZVON)
|<!-- Category: instruction -->
<xsl:apply-templates
select = node-set-expression
mode = qname>
<!-- Content: (xsl:sort <http://www.zvon.org/xxl/XSLTreference/W3C/xslt.html#element-sort> | xsl:with-param <http://www.zvon.org/xxl/XSLTreference/W3C/xslt.html#element-with-param>)* -->
</xsl:apply-templates>|


sort and with-param being the only recognized child elements...

or should I write a four-cases choose instruction, with four different
options combinations?

Marco

Current Thread