xsl-list
[Top] [All Lists]

Context node traversal inside predicates (was: Nodes and Strings)

2005-07-26 05:10:28
Hello group,

Tempore 22:47:47, die 07/25/2005 AD, hinc in xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com scripsit Elaine Prata <Elaine(_dot_)Prata(_at_)quality(_dot_)com(_dot_)br>:

<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)
"Εν οίδα ότι ουδέν οίδα"  - Σωκρατης

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>