Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: search all elements?

From: Oleg Tkachenko <may@--.---->
To: NULL
Date: 2/7/2008 1:28:00 PM

Well, if your keyword is a one word, you can just check agenda element 
string value:
<xsl:apply-templates mode="search"
select="agendas/agenda[contains(translate(.,$UC,$lc), $Keyword)]">
</xsl:apply-templates>

Alternatively you can do this trick:
<xsl:for-each select="agendas/agenda">
	<xsl:variable name="process-it">
		<xsl:for-each select="*">
			<xsl:if test="translate(.,$UC,$lc), $Keyword">1</xsl:if>
		</xsl:for-each>
	</xsl:variable>
	<xsl:if test="$process-it != ''">
		<xsl:apply-templates select="." mode="search"/>
	</xsl:if>
</xsl:for-each>

-- 
Oleg

guoqi zheng wrote:
> Dear Sir,
> 
> I have below filter function using XSLT .
> ---------------------------------------------------------------------------------------
>     <xsl:apply-templates mode="search" 
> select="agendas/agenda[contains(translate(intro,$UC,$lc), $Keyword) or 
> contains(translate(title,$UC,$lc), $Keyword)]">
>     </xsl:apply-templates>
> ----------------------------------------------------------------------------------------
> XML is an agenda list which contains many fields. an example is given beloe.
> 
> ---------------------------------------------------------------------------------------
> <agendas>
> <agenda id=1>
> <title>title of it</title>
> <intro>some intro text here </intro>
> <location>america</location>
> <members>someone, me </members>
> <remarks>some remarkds </remarks>
> <schedule>content of the event </schedule>
> </agenda>
> </agendas>
> ----------------------------------------------------------------------------------------------
> 
> In above example, I use apply-templates, contains to filter data, and I use 
> keyword "or" to search multiple fields now, but this isn't a good solution. 
> because I need to search into many element. in above example, I only search 
> "intro" and "title".
> 
> How can I search all elements? I try "node()", but it does not work out?
> 
> Regards,
> 
> Guoqi Zheng 
> 
> 


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent