[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] How to get XPath in a XSLT shylesheet
- From: Long JingJun <longjingjun@yahoo.com.cn>
- To: David Carlisle <davidc@nag.co.uk>
- Date: Tue, 9 Jan 2007 13:49:51 +0800 (CST)
Hi all,
My original target is to get the XPath to identify the location of an element in the XML output (as location attribute for an example). So that I can find the original place in the source file when I go through the generated XML output. What I mean full XPath is like this: /document/chapter[2]/section[3]/subject[1]/para[2]
Thanks all. You answered my question.
Regards,
Long
----- Original Message ----
From: David Carlisle <davidc@nag.co.uk>
To: rjm@zenucom.com
Cc: xml-dev@lists.xml.org
Sent: Monday, January 8, 2007 7:07:32 PM
Subject: Re: [xml-dev] How to get XPath in a XSLT shylesheet
> yes but as pointed out to me (and this is just a simple extension of
> using name() ) it does not include the - hmmm.... arity? .... of the
> node
answer 4 on that page does include the element counts.
> so i think this is an even better question now because clearly XPath
> knows otherwise it couldn't answer the question, but can it make the
> statement?
There are any number of xpath expressions that might select a node,
/descendant::*[27]
/*[2]/*[5]/*[1]
/a/b[2]/c[1]
id('foo')
...
An XPath engine in general won't "know" any of them. Given an Xpath
statement it will execute it and return some nodes, but it doesn't in
general know which statements would have results that include a given
node. Just as an arithmetic evaluation engine doesn't in general know
all (or any) of the possible arithemtic expressions that evaluate to 42,
just because it can evaluate 40+2.
Some systems have extension elements that may be a bit more efficient
than the xslt/xpath solutions, eg saxon:path().
David
_______________________________________________________________________
XML-DEV is a publicly archived, unmoderated list hosted by OASIS
to support XML implementation and development. To minimize
spam in the archives, you must subscribe before posting.
[Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
subscribe: xml-dev-subscribe@lists.xml.org
List archive: http://lists.xml.org/archives/xml-dev/
List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
____________________________________________________________________________________
Need a quick answer? Get one in minutes from people who know.
Ask your question on www.Answers.yahoo.com
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]