
November 6th, 2012, 11:30 AM
|
|
Registered User
|
|
Join Date: May 2012
Posts: 11
Time spent in forums: 4 h 56 m 47 sec
Reputation Power: 0
|
|
|
Searching for text elements and inexact matches with XSL
I'm writing a basic XSL to search through a XML file that reads like this;
Code:
<cbo_list>
<cbo>
<cbo_id>25</cbo_id>
<cbo_name>Alianza Dominicana, Inc.</cbo_name>
<cbo_address>2410 Amsterdam Avenue, 4th Fl</cbo_address>
<cbo_city>New York</cbo_city>
<cbo_state>NY</cbo_state>
<cbo_zip>10033</cbo_zip>
</cbo>
<cbo>
<cbo_id>916</cbo_id>
<cbo_name>Asociaciones Dominicanas, Inc</cbo_name>
<cbo_address>202 Union Avenue, 2, L&M</cbo_address>
<cbo_city>Brooklyn</cbo_city>
<cbo_state>NY</cbo_state>
<cbo_zip>11211</cbo_zip>
</cbo>
The XSL is;
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="CBO"/>
<xsl:template match="/">
<html>
<body>
<h2>Results</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>ID#</th>
<th>Name</th>
<th>Address</th>
<th>City</th>
<th>State</th>
<th>Zipcode</th>
</tr>
<xsl:for-each select="dycd_bridge/contracts_datastore/cbo_list/cbo[node()=$CBO]">
<tr>
<td><xsl:value-of select="cbo_id"/></td>
<td><xsl:value-of select="cbo_name"/></td>
<td><xsl:value-of select="cbo_address"/></td>
<td><xsl:value-of select="cbo_city"/></td>
<td><xsl:value-of select="cbo_state"/></td>
<td><xsl:value-of select="cbo_zip"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Basically, the user searches via a standard HTML search box that then passes the parameters to the XSL. The problem is, the XSL will only return results if an exact match is found, and it won't even process the search if alphabetic characters are present. How do I fix this?
|