Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - search all elements? >Thread Next - Re: search all elements? Re: search all elements?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 > > | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
