473,322 Members | 1,699 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,322 software developers and data experts.

XPATH Basic question

Hi, a quick basic question here on XPATH

if I have the following data

<X>
<X1>TEST</X1>
<Z>
<Z1>Item 1</Z1>
<Z2>Item 2</Z2>
<Z3>Item 3</Z3>
</Z>
</X>
<X>
<X1>TEST2</X1>
<Z>
<Z1> ... </Z1>
<Z2> ... etc.
</Z>
</X>

will the following XPATH statement be valid in a template match
statement? My experience has been no, and I have had to get the root
node X and then do an if on X1 before processing. See below for the
statement. Any ideas on how to get this to work in a single XPATH
statement?
<xsl:template match="/X/X1[starts-with(text(),'TEST2']/Z">
<!-- assumption here is that I get the <Z> node to process -->
<!-- however I am thinking that the predicate has to be the last
statement in an XPATH statement, is this true?-->

Jul 20 '05 #1
1 1060

"bjam" <bs****@yahoo.com> wrote in message
news:11**********************@l41g2000cwc.googlegr oups.com...
Hi, a quick basic question here on XPATH

if I have the following data

<X>
<X1>TEST</X1>
<Z>
<Z1>Item 1</Z1>
<Z2>Item 2</Z2>
<Z3>Item 3</Z3>
</Z>
</X>
<X>
<X1>TEST2</X1>
<Z>
<Z1> ... </Z1>
<Z2> ... etc.
</Z>
</X>

will the following XPATH statement be valid in a template match
statement? My experience has been no, and I have had to get the root
node X and then do an if on X1 before processing. See below for the
statement. Any ideas on how to get this to work in a single XPATH
statement?
<xsl:template match="/X/X1[starts-with(text(),'TEST2']/Z">
Yes.
<!-- assumption here is that I get the <Z> node to process -->
<!-- however I am thinking that the predicate has to be the last
statement in an XPATH statement, is this true?-->


No.
Cheers,
Dimitre Novatchev
Jul 20 '05 #2

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

Similar topics

3
by: Kathy Burke | last post by:
Hi again, I'm using the following xpath (works in visualizer) with a SelectSingleNode("xpath") statement. //Station/(WI])]/@order Problem is I get an error "expression passed to this method...
1
by: Mark Snelling | last post by:
Hi, I have a question regarding XPath and namespaces. I have a piece of XML... <Cred> <Meta> <Type xmlns='syncml:metinf'>syncml:auth-basic</Type> </Meta> <Data>QnJ1Y2UyOk9oQmVoYXZl</Data>...
7
by: Tim Hallwyl | last post by:
Hi, there! As I understand the XPaht recommendation, the context node is a node; not a node-list, not XPath object -- but a single node. Now, the WS-BPEL 2.0 specification allows an XML simple...
1
by: bruce | last post by:
Hi. Got a test web page, that basically has two "<html" tags in it. Examining the page via Firefox/Dom Inspector, I can create a test xpath query "/html/body/form" which gets the target form for...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.