[xsl] Compact XPath syntax

Subject: [xsl] Compact XPath syntax
From: "Ramkumar Menon" <ramkumar.menon@xxxxxxxxx>
Date: Wed, 19 Dec 2007 15:44:26 -0800
Gurus,

As we all know, absolute Path Expressions are written up as a set of
node-tests separated by "/".
I was wondering why XPath did not introduce the notion of compact path
expressions where the expression will only have a unambiguous
node-test instead of the entire path.
The compact XPath expression could then be actually compiled into the
complete xpath expression at compilation time.

For instance, consider the following XML.
<a>
  <b>
     <c>
  </b>
</a>

I could refer to the node "c" as just "c" or maybe "!c", with some
syntax sugar [without the quotes of course], as long as "c" can be
compiled into the actual path exprssion.[/a/b/c]
Consider another XML.

<a>
  <b>
     <c>
  </b>
  <f>
     <c>
  </f>
</a>
I could refer to the node "c" as "!c", which matches all "c" nodes at
all levels. I specify something on the lines of  !c[parent::b] or
!c[parent::f] to address the respective "c" nodes.

I think I've made it clear.
I am curious to know your thoughts on this.

Ram

Current Thread