<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>pagis's Feed - Programmer's Heaven</title>
    <link>http://www.programmersheaven.com/feed/User/331584/RSS.aspx</link>
    <description>Events at Programmer's Heaven related to the user pagis.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Sun, 19 May 2013 20:29:34 -0700</pubDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <item>
      <title>How can I use the current object in a loop as part of a query?</title>
      <link />
      <description>&lt;p&gt;Posted a 'new message on the XML Development forum.&lt;/p&gt;Hi,&lt;br /&gt;
&lt;br /&gt;
I have an XML document with 2 parts, meta data and data.&lt;br /&gt;
In the data part I have a list of word elements and each word element has several test elements indicating tests that were done of this word and the results of these tests (each test has a separate test element which is a sub element of word). each test element has a passed attribute with a Boolean value&lt;br /&gt;
&lt;br /&gt;
In the metadata part I have a list of all the tests that were conducted in general (on all the words).&lt;br /&gt;
&lt;br /&gt;
I want to loop around the tests in the metadata part and for each test I want to count the words that have this test as a subelement with a True value to the passed attribute. I couldn't find any way to do this.&lt;br /&gt;
&lt;br /&gt;
what I'm trying to basically do is to use the name of the test in the current part of the loop as part of a separate XPath query?&lt;br /&gt;
&lt;br /&gt;
Here is an example of the XML document:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?xml version="1.0" encoding="ISO-8859-1"?&amp;gt;&lt;br /&gt;
&amp;lt;compare&amp;gt;&lt;br /&gt;
  &amp;lt;info&amp;gt;&lt;br /&gt;
    &amp;lt;file type="semcor"&amp;gt;/freespace/stud/omerholz/NLP/SemCor/Compare/scstat_br-ca01_wf.xml&amp;lt;/file&amp;gt;&lt;br /&gt;
    &amp;lt;file type="rawresults"&amp;gt;/freespace/stud/omerholz/NLP/results/2009-01-03-12-47/raw_results/prob_ss_given_W_final_ca01.xml&amp;lt;/file&amp;gt;&lt;br /&gt;
    &amp;lt;list type="tests"&amp;gt;&lt;br /&gt;
      &amp;lt;item type="test" name="firstequal"&amp;gt;Test whether the supersense with the highest rank is identical&amp;lt;/item&amp;gt;&lt;br /&gt;
      &amp;lt;item type="test" name="hresholdnonordered"&amp;gt;Test whether the group of highest ranked supersenses is identical, not checking whether the order is identical&amp;lt;/item&amp;gt;&lt;br /&gt;
      &amp;lt;item type="test" name="hresholdordered"&amp;gt;Test whether the group of highest ranked supersenses is identical, not checking whether the order is identical&amp;lt;/item&amp;gt;&lt;br /&gt;
    &amp;lt;/list&amp;gt;&lt;br /&gt;
  &amp;lt;/info&amp;gt;&lt;br /&gt;
  &amp;lt;comparison&amp;gt;&lt;br /&gt;
    &amp;lt;word lemma="shot"&amp;gt;&lt;br /&gt;
      &amp;lt;test name="firstequal" passed="False" description="True"&amp;gt;&lt;br /&gt;
        &amp;lt;description&amp;gt;Test whether the supersense with the highest rank is identical&amp;lt;/description&amp;gt;&lt;br /&gt;
        &amp;lt;sense type="semcor" rank="1"&amp;gt;noun.act&amp;lt;/sense&amp;gt;&lt;br /&gt;
      &amp;lt;/test&amp;gt;&lt;br /&gt;
      &amp;lt;test threshold="0.8" name="hresholdnonordered" passed="True" description="True"&amp;gt;&lt;br /&gt;
        &amp;lt;description&amp;gt;Test whether the group of highest ranked supersenses is identical, not checking whether the order is identical&amp;lt;/description&amp;gt;&lt;br /&gt;
        &amp;lt;sense type="semcor" rank="1" sense="noun.act"&amp;gt;1.0&amp;lt;/sense&amp;gt;&lt;br /&gt;
      &amp;lt;/test&amp;gt;&lt;br /&gt;
      &amp;lt;test threshold="0.8" name="hresholdordered" passed="False" description="True"&amp;gt;&lt;br /&gt;
        &amp;lt;description&amp;gt;Test whether the group of highest ranked supersenses is identical, not checking whether the order is identical&amp;lt;/description&amp;gt;&lt;br /&gt;
        &amp;lt;sense type="semcor" rank="1" sense="noun.act"&amp;gt;1.0&amp;lt;/sense&amp;gt;&lt;br /&gt;
      &amp;lt;/test&amp;gt;&lt;br /&gt;
    &amp;lt;/word&amp;gt;&lt;br /&gt;
    &amp;lt;word lemma="office"&amp;gt;&lt;br /&gt;
      &amp;lt;test name="firstequal" passed="False" description="True"&amp;gt;&lt;br /&gt;
        &amp;lt;description&amp;gt;Test whether the supersense with the highest rank is identical&amp;lt;/description&amp;gt;&lt;br /&gt;
        &amp;lt;sense type="semcor" rank="1"&amp;gt;noun.group&amp;lt;/sense&amp;gt;&lt;br /&gt;
      &amp;lt;/test&amp;gt;&lt;br /&gt;
      &amp;lt;test threshold="0.8" name="hresholdnonordered" passed="True" description="True"&amp;gt;&lt;br /&gt;
        &amp;lt;description&amp;gt;Test whether the group of highest ranked supersenses is identical, not checking whether the order is identical&amp;lt;/description&amp;gt;&lt;br /&gt;
        &amp;lt;sense type="semcor" rank="1" sense="noun.group"&amp;gt;1.0&amp;lt;/sense&amp;gt;&lt;br /&gt;
      &amp;lt;/test&amp;gt;&lt;br /&gt;
      &amp;lt;test threshold="0.8" name="hresholdordered" passed="False" description="True"&amp;gt;&lt;br /&gt;
        &amp;lt;description&amp;gt;Test whether the group of highest ranked supersenses is identical, not checking whether the order is identical&amp;lt;/description&amp;gt;&lt;br /&gt;
        &amp;lt;sense type="semcor" rank="1" sense="noun.group"&amp;gt;1.0&amp;lt;/sense&amp;gt;&lt;br /&gt;
      &amp;lt;/test&amp;gt;&lt;br /&gt;
    &amp;lt;/word&amp;gt;&lt;br /&gt;
  &amp;lt;/comparison&amp;gt;&lt;br /&gt;
&amp;lt;compare&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And this is an example of an XSLT code I was trying to use but it doesn't work (I hope that reading it will give better insight to what I was trying to achieve):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;xsl:for-each select="compare/info/list[@type='tests']/item"&amp;gt;&lt;br /&gt;
   &amp;lt;xsl:variable name="tname" select="@name" /&amp;gt;&lt;br /&gt;
   &amp;lt;xsl:value-of select="translate('count(/compare/comparison/word/test[@name=&amp;amp;quot;%s&amp;amp;quot; and  @passed=&amp;amp;quot;True&amp;amp;quot;]/parent::node()/@lemma)','%s'$tname"/&amp;gt;&lt;br /&gt;
&amp;lt;/xsl:for-each&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Anyone has an idea how I may use the name of the test in the current part of the loop as part of a separate XPath query?&lt;br /&gt;
&lt;br /&gt;
Thanks for any help :)&lt;br /&gt;</description>
      <pubDate>Tue, 06 Jan 2009 13:52:42 -0700</pubDate>
    </item>
  </channel>
</rss>