How can I use the current object in a loop as part of a query? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

How can I use the current object in a loop as part of a query?

pagispagis Posts: 1Member
Hi,

I have an XML document with 2 parts, meta data and data.
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

In the metadata part I have a list of all the tests that were conducted in general (on all the words).

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.

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?

Here is an example of the XML document:

<?xml version="1.0" encoding="ISO-8859-1"?>


/freespace/stud/omerholz/NLP/SemCor/Compare/scstat_br-ca01_wf.xml
/freespace/stud/omerholz/NLP/results/2009-01-03-12-47/raw_results/prob_ss_given_W_final_ca01.xml

Test whether the supersense with the highest rank is identical
Test whether the group of highest ranked supersenses is identical, not checking whether the order is identical
Test whether the group of highest ranked supersenses is identical, not checking whether the order is identical





Test whether the supersense with the highest rank is identical
noun.act


Test whether the group of highest ranked supersenses is identical, not checking whether the order is identical
1.0


Test whether the group of highest ranked supersenses is identical, not checking whether the order is identical
1.0




Test whether the supersense with the highest rank is identical
noun.group


Test whether the group of highest ranked supersenses is identical, not checking whether the order is identical
1.0


Test whether the group of highest ranked supersenses is identical, not checking whether the order is identical
1.0






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):







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?

Thanks for any help :)
Sign In or Register to comment.