[xsl] Re:[xsl] problem with xsl:if test statement

Subject: [xsl] Re:[xsl] problem with xsl:if test statement
From: Amy Huang <h.amy88@xxxxxxxxx>
Date: Tue, 18 Dec 2007 18:21:38 -0800 (PST)
I got the solution from another list (I posted my question last week. I thought I wouldn't get a reply. Next time I'll wait a few more days).
I'll post the solution here so it might be of help to others.

Use single quotes for the parameter.
<xsl:param name="Country" select="'Mexico'" />

Change the for-each with:
<xsl:if test="Products/Fruits[Country = $Country and Type = 'Apples']">


>I'm new to xml and xsl. I need to generate one link if my query finds 
>one or more records in my XML document. But I if I use "for each 
>statement", the link will repeat again and again depending on how many 
>records satisfy my query. E.g., if 2 records satisfy my query, the link will repeat twice like this: 

>For apples, click here 
>For apples, click here 

>How can I generate only one link if my query finds more than one records? 

Amy


      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs

Current Thread