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

Context node traversal inside predicates (was: Nodes a

Subject: Context node traversal inside predicates (was: Nodes and Strings)
From: "Joris Gillis" <roac@xxxxxxxxxx>
Date: Tue, 26 Jul 2005 14:10:28 +0200
xpath previous context
Hello group,

Tempore 22:47:47, die 07/25/2005 AD, hinc in xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit Elaine Prata <Elaine.Prata@xxxxxxxxxxxxxx>:

<setA>
    <element>value1</element>
    <element>value2</element>
    <element>value3</element>
    <element>value4</element>
    <element>value5</element>
</setA>

<setB>
    <element>aStringBeforeValue.value1</element>
    <element>aStringBeforeValue.value2</element>
    <element>aStringBeforeValue.value3</element>
</setB>

expected result (for intersection between the sets):

<setC>
    <element>value1</element>
    <element>value2</element>
    <element>value3</element>
</setC>


This problem encouraged me to finally post about some lack of functionality I've always been experiencing in XPath1.0


I'd wish I could solve the problem above with an Xpath like this:

$SetA/Element[$setB/Element[substring-after(.,'.')=context(1)]]

The 'context()' function would be similar to the 'current()' fuction.
It would recall previous context nodes.

'context(n)' would recall the n-th context node (as found when propagating upwards in the predicates of the expression)

e.g.:
'context(0)' is equal to '.'
'context(1)' is equal to the context node as constructed by the immmediately outer predicate.
...
'context(-1)' would be equal to the context node as found in the outermost predicate.


Will this kind of functionality be available in Xpath 2 ? Or is it a proof of bad coding practices that one thinks he should be needing this?

please ask for more explanation if I did not stated this clear.

Thanks in advance for any reply...
--
Joris Gillis (http://users.telenet.be/root-jg/me.html)
"NN= N?N/N4N1 OON9 N?ON4N-N= N?N/N4N1"  - N#O	N:ON1ON7O

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.