Thread: if test=????
View Single Post
  #1 (permalink)  
Old August 24th, 2006, 08:08 AM
jmirickhai jmirickhai is offline
Registered User
 
Join Date: Aug 2006
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default if test=????

I have a field to search and a search string. I need all the records whose field starts with the search string. Something like.

For example given the following xml file I would like to be a able to do something like:
return all cd elements whose artist's name starts with "Bo"


<?xml version="1.0" encoding="ISO-8859-1"?>

<catalog>
    <cd>
        <title>Empire Burlesque</title>
        <artist>Bob Dylan</artist>
        <country>USA</country>
        <company>Columbia</company>
        <price>10.90</price>
        <year>1985</year>
    </cd>
    <cd>
        <title>Hide your heart</title>
        <artist>Bonnie Tyler</artist>
        <country>UK</country>
        <company>CBS Records</company>
        <price>9.90</price>
        <year>1988</year>
    </cd>
    <cd>
        <title>Greatest Hits</title>
        <artist>Dolly Parton</artist>
        <country>USA</country>
        <company>RCA</company>
        <price>9.90</price>
        <year>1982</year>
    </cd>
</catalog>



Im not quite sure how to write the test for that

<xsl:for-each select="cd">
  <xsl:if test="???????? what goes here ??????">

Thanks

Reply With Quote