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

RE: Best way to use global params in templates to cove

Subject: RE: Best way to use global params in templates to cover potential com binations?
From: Americo Albuquerque <melinor@xxxxxxxx>
Date: Wed, 1 Oct 2003 00:28:50 +0100
xsl apply templates not exist
Hi

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Kathy Burke
> Sent: Monday, September 29, 2003 6:34 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Best way to use global params in templates to 
> cover potential com binations?
> 
> 
(...)
> To date, I've only used a simple template, not requiring the 
> use of these parameters as filters:
> 
> 	<xsl:template match="link">
> 	      <a target='_blank" 
> href="{@url}"><xsl:apply-templates/></a>
> 	</xsl:template>
> 
> 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 {@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.
> 

You can use <xsl:choose> as J.Pietschmann said or you can use <xsl:if>
all depends on what you want to do with the link

The xsl:if template:
<xsl:template match="link">
 <xsl:if test="(not(@Customer) or (@Customer=$Customer)) and
(not(@Assembly) or (@Assembly=$Assembly))">
  <a href="{@urlf}"><xsl:apply-templates/></a>
 </xsl:if>
</xsl:template>

This will create a <a> node (if @Customer does not exists or if it's
value is equal to $Customer) and (if @Assembly does not exists or if
it's value is equal to $Assembly)

Regards,
Americo Albuquerque


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


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.