473,394 Members | 1,750 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Xpath Relational Query (like a join)

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
3 2179
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
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
Look up "predicate expressions"

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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Terry P | last post by:
Are there any tools (java classes, tag libraries) which can translate xpath statements into a SQL query? Given an xpath query which has a predicate that filters node values or attributes, I want...
6
by: Michael | last post by:
To all, I am trying to query an XML document of the following structure. <ROOT> <A> <B id="1"/> <B id="2"/> <B id="3"/> </A>
2
by: Echo 8 | last post by:
Is there a simple way of compare dates? I am trying to create a list of perishable stock in an inventory that is near or past its expiration date. I've tried telling it to compare a node's value...
0
by: chandrika.tripathy | last post by:
I am new to XML. I have the following question. I have data stored in a relational database. I want to use XPATH to query it. I have a schema defined which represents the data in the database. Is...
3
by: bruce | last post by:
for guys with python/xpath expertise.. i'm playing with xpath.. and i'm trying to solve an issue... i have the following kind of situation where i'm trying to get certain data. i have a...
2
by: werD | last post by:
Hello, Im wondering about using xml to store relational data. It works well with .net but im having some trouble with the xsl/xpath. Lets say that I have an xml like <data> <files> <file...
3
by: Jason Mobarak | last post by:
Hello -- I'm attempting to get a handle on how to do xpath queries with System.Xml -- so far the biggest hurdle has been how to deal with a default namespace. If I use the test xml: <?xml...
3
by: Bloody Viking | last post by:
Namaste, Y'all! I've got a valid XQuery expression that I need to convert to XPath 2.0. This expression will be stored in a resource file and applied to XML by a Java program with saxon8.jar...
13
by: sulyokpeti | last post by:
I have made a simple python module to handle SQL databases: https://fedorahosted.org/pySQLFace/wiki Its goal to separate relational database stuff (SQL) from algorythmic code (python). A SQLFace...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.