[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: (simple?) xpath question

Subject: Re: (simple?) xpath question
From: mark bordelon <markcbordelon@xxxxxxxxx>
Date: Fri, 29 Aug 2008 13:19:45 -0700 (PDT)
Re:  (simple?) xpath question
Evan,  (and everyone)

Thanks for this great help.
I am seizing the xpath solution so far (keeping the xsl solution in the back of my mind as plan B)

However, in Altova Spy neither
//*[self::a or self::c]
nor
//*[name() = 'a' or name() = 'c']

is returning any results. Syntax is fine, just no results.

This is the only tool I have for testing, other than writing code. Is there a configuration in Altova Spy I need to tweek?

Mark


--- On Fri, 8/29/08, Evan Lenz <evan@xxxxxxxxxxxx> wrote:

> From: Evan Lenz <evan@xxxxxxxxxxxx>
> Subject: Re:  (simple?) xpath question
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Date: Friday, August 29, 2008, 1:14 PM
> A better approach is to use the self axis along with true
> name tests:
> 
> //*[self::a or self::c]
> 
> The name() function will work too, but it will also select
> <a> and <c> 
> elements regardless of what their namespace is (and it may
> give 
> inconsistent results in such cases depending on whether
> prefixes are 
> used in the input or not). An actual name test in the
> expression, 
> indicating that you're only interested in <a> and
> <c> elements that 
> aren't in a namespace, is the way to go.
> 
> Evan
> 
> 
> mozer wrote:
> > Mark,
> >
> > //*[name() = 'a' or name() = 'c']
> >
> > is the right syntax
> >
> > Xmlizer
> >
> > On Fri, Aug 29, 2008 at 9:57 PM, mark bordelon
> <markcbordelon@xxxxxxxxx> wrote:
> >   
> >> Thanks, Colin,
> >>
> >>
> >> Although the requirements cannot assume how many
> levels there are between the root node and the desired node,
> your solution points me to something like this. Does this
> work?
> >>
> >>
> >> //[name() == "a" and name() ==
> "c"]
> >>
> >>
> >>
> >>
> >> --- On Fri, 8/29/08, Colin Paul Adams
> <colin@xxxxxxxxxxxxxxxxxx> wrote:
> >>
> >>     
> >>> From: Colin Paul Adams
> <colin@xxxxxxxxxxxxxxxxxx>
> >>> Subject: Re:  (simple?) xpath question
> >>> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> >>> Date: Friday, August 29, 2008, 12:22 PM
> >>>       
> >>>>>>>> "Mark" == mark
> bordelon
> >>>>>>>>                 
> >>> <markcbordelon@xxxxxxxxx> writes:
> >>>
> >>>     Mark> All *help*!    What is the best
> way to query
> >>> xml with xpath
> >>>     Mark> to get a disjoint nodelist?
> Specifically i
> >>> want to include
> >>>     Mark> just the root node alongwith a
> descendent
> >>> node.    XML:
> >>>     Mark> <a>   <b>    
> <c>
> >>> </c>  </b> </a>   XPATH:  
> //c
> >>>     Mark> DESIRED RESULT NODELIST: i.e. not
> this:
> >>> <c> </c>   but
> >>>     Mark> rather this: <a>  
> <c>
> >>> </c> </a>
> >>>
> >>> One possibility is:
> >>>
> >>> //*[name() != "b"]
> >>>
> >>> It depends on your exact requirements.
> >>> --
> >>> Colin Adams
> >>> Preston Lancashire

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.