![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries [Thread Prev] >Thread Next - Re: use contains to search through multiple nodes. use contains to search through multiple nodes.To: NULL Date: 3/17/2008 11:06:00 PM Dear Sir, I am using MSXML and XSLT to search one XML. I can use "contains" to search through all child nodes, I do not know how can search into other nodes of parent parent nodes. I got below XML. ---------------------------XML-------------------------------- <agendas> <agenda> <id>1112</id> <data> <content> <title>this is the title # 2</title> </content> <ref>GT355-332-234</ref> </data> <category>Finance</category> </agenda> ............. </agendas> ---------------------------End of XML ---------------------- I need to search keyword on <title>, also need to check <category> = certain value. I use below XSLT to search title node, how do I check <category> node match one value? should I use apply-templates twice or is there other solutions? ---------------------------------- XSLT ----------------------------------------- <!-- upper and lower case for case incensitive search.--> <xsl:variable name="lc">abcdefghijklmnopqrstuvwxyz</xsl:variable> <xsl:variable name="UC">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable> <xsl:template name="filter" match="/"> <!-- this will filter out data by keyword and/or datetime.--> <xsl:apply-templates select="/agendas/agenda/data/content[contains(translate(.,$UC,$lc), $Keyword)]"> </xsl:apply-templates> </xsl:template> ---------------------------------- END of XSLT ---------------------------------- -- Guoqi Zheng http://www.chinasoftware.eu | ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
