By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,812 Members | 1,288 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,812 IT Pros & Developers. It's quick & easy.

Xpath Relational Query (like a join)

P: n/a
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?

Aug 24 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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")%>

werD wrote:
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?
Aug 24 '06 #2

P: n/a
Nested Xpath statements worked well

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

Cheers
DrewG
werD wrote:
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")%>

werD wrote:
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?
Aug 24 '06 #3

P: n/a
Look up "predicate expressions"

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Aug 24 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.