Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Xpath Relational Query (like a join)

Status
Not open for further replies.

werD420

Technical User
Sep 14, 2004
181
0
0
US
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


the xml datasource is initialized with the xpath "/data"

<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?


Thanks in advance


MCP, .Net Solutions Development <%_%>
 
hey I figured out an easy way t d it by just nesting another xpath

ie.

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

MCP, .Net Solutions Development <%_%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top