[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Conditional with-param

Subject: RE: Conditional with-param
From: "M. David Peterson" <m.david@xxxxxxxxxx>
Date: Sun, 23 May 2004 08:24:22 -0600
xsl with param
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:  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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.