Xpath Relational Query (like a join)

W

werD

Hello

I have an xml document that im currently using a forward only .net
repeater on and using some xpath queries to display the data

The xml is quite simple

<?xml version="1.0" encoding="utf-8" ?>
<data>
<supervisors>
<supentry
id="1"
author="Jim"
attachment="1"
relevance="general"
date="8-24-06"><![CDATA[This is a test entry]]></supentry>
</supervisors>
<teamleads>
<tlentry
id="1"
author="Joe"
attachment="none"
relevance="Specific"
date="8-24-06"><![CDATA[This is a test entry]]></tlentry>
</teamleads>
<files>
<file name="A Form" id="1" filename="holymountains.txt" />
</files>
</data>


im using some xpath queries to get the data like below

<table>
<tr>
<td><%#XPath("supervisors//supentry/@author")%> </td>
<td><%#XPath("supervisors//supentry/@id")%></td>
</tr>
<tr>
<td colspan="2"><%#XPath("supervisors//supentry")%>
</td>
</tr>
<tr>
<td><%#XPath("supervisors//supentry/@relevance")%>
</td>
<td>
<!--Here's My Issue -->

<%#XPath("/files//file[@id=supervisors//supentry/@attachment]/@filename")%>
</td>
</tr>
</table>



Im having trouble pulling the filename attribute that has a matching id
if it exists.

is there an issue with my test for the matching id attribute?
 
W

werD

sorry this was
<%#XPath("files//file[@id=supervisors//supentry/@attachment]/@filename")%>


Ive also tried this trying to go back to the parent element w/no luck
<%#XPath("../files//file[@id=supervisors//supentry/@attachment]/@filename")%>
 
W

werD

Nested Xpath statements worked well

<%#XPath("files//file[@id=" &
XPath("supervisors//supentry/@attachment") & "]/@filename")%>

Cheers
DrewG

sorry this was
<%#XPath("files//file[@id=supervisors//supentry/@attachment]/@filename")%>


Ive also tried this trying to go back to the parent element w/no luck
<%#XPath("../files//file[@id=supervisors//supentry/@attachment]/@filename")%>


Hello

I have an xml document that im currently using a forward only .net
repeater on and using some xpath queries to display the data

The xml is quite simple

<?xml version="1.0" encoding="utf-8" ?>
<data>
<supervisors>
<supentry
id="1"
author="Jim"
attachment="1"
relevance="general"
date="8-24-06"><![CDATA[This is a test entry]]></supentry>
</supervisors>
<teamleads>
<tlentry
id="1"
author="Joe"
attachment="none"
relevance="Specific"
date="8-24-06"><![CDATA[This is a test entry]]></tlentry>
</teamleads>
<files>
<file name="A Form" id="1" filename="holymountains.txt" />
</files>
</data>


im using some xpath queries to get the data like below

<table>
<tr>
<td><%#XPath("supervisors//supentry/@author")%> </td>
<td><%#XPath("supervisors//supentry/@id")%></td>
</tr>
<tr>
<td colspan="2"><%#XPath("supervisors//supentry")%>
</td>
</tr>
<tr>
<td><%#XPath("supervisors//supentry/@relevance")%>
</td>
<td>
<!--Here's My Issue -->

<%#XPath("/files//file[@id=supervisors//supentry/@attachment]/@filename")%>
</td>
</tr>
</table>



Im having trouble pulling the filename attribute that has a matching id
if it exists.

is there an issue with my test for the matching id attribute?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top