I'm trying to create a search engine for 2 fields of type string (Legenda, Cidade). This search will include 2 inputs and one submit button.
Code:
<xsl:key name="dataLegenda" match="udt:Data" use="udt:Legenda" />
<xsl:key name="dataCidade" match="udt:Data" use="udt:Cidade" />
....
<xsl:variable name="prefix_param">udt_<xsl:value-of select="//udt:Context/udt:ModuleId" />_param</xsl:variable>
<xsl:param name="param_search" />
<xsl:param name="param_searchpostback" />
<xsl:param name="param_search1" />
<xsl:param name="param_searchpostback1" />
<xsl:param name="param_ispostback" />
<xsl:variable name="search">
<xsl:choose>
<xsl:when test="$param_ispostback">
<xsl:value-of select="$param_searchpostback" />
<xsl:value-of select="$param_searchpostback1" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$param_search" />
<xsl:value-of select="$param_search1" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:template match="/udt:UserDefinedTable">
<xsl:variable name="searchColumns" select="//udt:Fields[udt:Searchable='true']/udt:ValueColumn" />
<xsl:if test="//udt:Fields[udt:Searchable='true']">
<xsl:call-template name="SearchForm" />
</xsl:if>
<xsl:variable name="currentData" select="udt:Data[contains(*[name()=$searchColumns][1],$search) or contains(*[name()=$searchColumns][2],$search) or contains(*[name()=$searchColumns][3],$search) or contains(*[name()=$searchColumns][4],$search) or contains(*[name()=$searchColumns][5],$search)]" />
<xsl:if test="$currentData">
<table>
<xsl:apply-templates select="$currentData" mode="list">
</xsl:apply-templates>
</table>
</xsl:if>
</xsl:template>
<xsl:template name="SearchForm">
<input type="text" name="{$prefix_param}_searchPostback" value="{udt:Data[key('dataLegenda', udt:Legenda)[0]]}" />
<input type="text" name="{$prefix_param}_searchPostback1" value="{udt:Data[key('dataCidade', udt:Cidade)[0]]}" />
<input type="submit" name="go" value="{//udt:Context/udt:LocalizedString_Search}" />
<input type="hidden" name="{$prefix_param}_ispostback" value="true" />
</xsl:template>
I'm only able to search in one input. Need some help to fix this...