Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


use contains to search through multiple nodes.

From: "Guoqi Zheng" <no@-----.--->
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 



transparent
Print
Mail
Digg
delicious
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