This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Searching a string for partial match; like vb InString or sql LIKE


I am trying to search any portion of the value of a node in an XML file for
a match with a param passed. I am finding when I use the "contains()"
function I have to have an exact match for it to work.  How do I search
string for a match in any portion.... Say I wanted to match any school with
the word "High" in the "school_name".  (Similar to the vb function of
InString or sql's LIKE %High%

In the example below, it does not work with partial name.

I have an xml file similar to:

<school>
	<school_name>Adams High</school_name>
</school>



I have a the following xsl

<xsl:param name="xName" select='"Adam"'/>

	<xsl:template match="/">
		<xsl:apply-templates select="//school[contains($xName,
school_name)]"/>
	</xsl:template>

	<xsl:template match="//school">
		<xsl:value-of select="school_name"/>
	</xsl:template>


Thanks for all help !!!!!!!  :)

Thanks,
 
Bill Shaw
eGov Web Solutions Team
301 W. Jefferson, Suite 400
Phoenix, AZ 85003-2157
 
PH 602-506-7919     FAX 602-506-5864
 
http://www.maricopa.gov

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]