[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
You either need to post more details about the input XML, or contact Altova support. Otherwise, it's pure speculation. The only thing I can think of is that there's a namespace declaration at the top that you're failing to take into account (e.g., xmlns="http://example.com"). But even then, the name() function should work if prefixes aren't being used.
Evan
mark bordelon wrote:
Re: [xsl] (simple?) xpath question
Subject: Re: [xsl] (simple?) xpath question From: Evan Lenz <evan@xxxxxxxxxxxx> Date: Fri, 29 Aug 2008 13:32:53 -0700 |
You either need to post more details about the input XML, or contact Altova support. Otherwise, it's pure speculation. The only thing I can think of is that there's a namespace declaration at the top that you're failing to take into account (e.g., xmlns="http://example.com"). But even then, the name() function should work if prefixes aren't being used.
Evan
mark bordelon wrote:
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: [xsl] (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,<markcbordelon@xxxxxxxxx> wrote:
//*[name() = 'a' or name() = 'c']
is the right syntax
Xmlizer
On Fri, Aug 29, 2008 at 9:57 PM, mark bordelon
levels there are between the root node and the desired node,Thanks, Colin,
Although the requirements cannot assume how many
your solution points me to something like this. Does this
work?
"c"]//[name() == "a" and name() ==
<colin@xxxxxxxxxxxxxxxxxx> wrote:
--- On Fri, 8/29/08, Colin Paul Adams
<colin@xxxxxxxxxxxxxxxxxx>From: Colin Paul Adams
bordelonSubject: Re: [xsl] (simple?) xpath question
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Date: Friday, August 29, 2008, 12:22 PM
"Mark" == mark
way to query<markcbordelon@xxxxxxxxx> writes:
Mark> All *help*! What is the best
Specifically ixml with xpath
Mark> to get a disjoint nodelist?
descendentwant to include
Mark> just the root node alongwith a
<c>node. XML:
Mark> <a> <b>
//c</c> </b> </a> XPATH:
this:Mark> DESIRED RESULT NODELIST: i.e. not
<c><c> </c> but
Mark> rather this: <a>
</c> </a>
One possibility is:
//*[name() != "b"]
It depends on your exact requirements. -- Colin Adams Preston Lancashire
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] (simple?) xpath question, mark bordelon | Thread | Re: [xsl] (simple?) xpath question, mark bordelon |
Re: [xsl] (simple?) xpath question, mark bordelon | Date | Re: [xsl] (simple?) xpath question, mark bordelon |
Month |