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

Re: How to get XPath in a XSLT shylesheet

  • From: Long JingJun <longjingjun@y...>
  • To: David Carlisle <davidc@n...>
  • Date: Tue, 9 Jan 2007 13:49:51 +0800 (CST)

Re:  How to get XPath in a XSLT shylesheet
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@n...>
To: rjm@z...
Cc: xml-dev@l...
Sent: Monday, January 8, 2007 7:07:32 PM
Subject: Re:  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@l...
subscribe: xml-dev-subscribe@l...
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]


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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.