xsl-list
[Top] [All Lists]

RE: Best way to use global params in templates to cover pot ential com binations?

2003-09-29 11:50:35
many thanks, J.

kathy

-----Original Message-----
From: J.Pietschmann [mailto:j3322ptm(_at_)yahoo(_dot_)de]
Sent: Monday, September 29, 2003 2:18 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Best way to use global params in templates to cover
potential com binations?


Kathy Burke wrote:
In English, I need to cover in xsl all potential combinations of Customer
and Assembly (exists or not exists), for example:

1. If the Customer attribute does NOT exist in <link>, show the link
{(_at_)url}
regardless of the param value for customer XYZ.
2. If the Customer attribute DOES exist, show the link ONLY if the
attribute
matches the param value XYZ.
3. Also, various combinations of Customer AND Assembly attributes exist,
etc.

Seems like you want to use xsl:choose:
  <xsl:temlate match="link">
    <xsl:choose>
      <xsl:when test="not(@Customer)">
        <a href="{(_at_)url}> ... </a>
      </xsl:when>
      <xsl:when test="@Customer=$Customer">
        <a href="{(_at_)url}> ... </a>
      </xsl:when>
      <!-- add your various combinations -->?
    </xsl:choose>
   </xsl:template>

Only the first when clause whose test evaluates to true will
be executed, so be careful arranging them. Educate yourself
about xsl:otherwise too.

J.Pietschmann



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>
  • RE: Best way to use global params in templates to cover pot ential com binations?, Kathy Burke <=