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

Subject: RE: [xsl] Re:[xsl] problem with xsl:if test statement
From: "Nassar, Anthony" <ANassar@xxxxxxxx>
Date: Wed, 19 Dec 2007 14:37:07 -0500
Don't use for-each, but apply-templates, and qualify your selection with
[1].

-----Original Message-----
From: Amy Huang [mailto:h.amy88@xxxxxxxxx]
Sent: Tuesday, December 18, 2007 9:22 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] Re:[xsl] problem with xsl:if test statement

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