A valid way to do equivalent, from IRC:
[12:05] <eno> miguel: I believe you shouldn't add non-standard "ends-with" as the standard XPath implementation. Use extension framework instead.
[12:05] <eno> regarding https://github.com/mono/mono/commit/9b07497f9067ab4d3f4a7964f2868c7eafef1b5d
[13:39] <migueld> Seems like it is XPath 2.0
[13:46] <eno> Yes, XPath 2.0 contains that one. .NET implementation is for 1.0.
[13:46] <eno> This would help you to use XSLT extension http://msdn.microsoft.com/en-us/library/tf741884.aspx
[13:47] <eno> or this might be handy: http://msdn.microsoft.com/en-us/library/wxaw5z5e.aspx
[13:49] <eno> Add this under <stylesheet> or <transform> : <msxsl:script language="C#" implements-prefix="x" xmlns:msxsl="urn:schemas-microsoft-com:xslt">public bool ends_with (string s, string target) { return s.EndsWith (target); }</msxsl:script>
[13:49] <eno> and use "x:ends_with(foo, bar)" instead
According to http://www.w3.org/TR/xpath#predicates, a predicate [n] should be equivalent to [position()=n] for a number expression n. However, we currently have a PredicateIterator intepretation of [n] that has been corrected for the issue outlined in the bug report, leaving the position() function behind with an inappropriate, document-order value for reverse axes. Note that [n] is not treated by parsing or transforming to the same form as [position()=n] before evaluation, valid as that would be.
The discussion in that same section of the recommendation about forward and reverse axes and further remarks in http://www.w3.org/TR/xpath#node-sets make it clear that the predicate [1] has the sense of "nearest" rather than "first in the document" which then, depending on the axis type, may be the same or reverse of the document order. It does not seem to me to be so clear whether the order given by a navigator for a location path expression should mirror this or always give the document order. The .Net implementation seems to always give the document order, as well as predicates having the correct reverse/forward senses, so I have added test cases that explore both.
* DefaultContext.cs : do not use sloppy XmlConvert to parse xpath
number. Fixed bug #556619.
* XslTransformTests.cs : added test for bug #556619 by
Tor Lillqvist.
svn path=/trunk/mcs/; revision=146613
* DefaultContext.cs : now number formatting for "R" works fine, so
just use it (and remove conditional compilation for TARGET_JVM).
svn path=/trunk/mcs/; revision=95479
* DefaultContext.cs,
Expression.cs,
Iterator.cs : Now RequireSorting is not required in BaseIterator
(it is now fully in Expression).
Removed the last ListIterator .ctor() argument.
* XslKey.cs : removed last ListIterator.ctor() argument.
Reverted the last commit that changed internal key index change
from ArrayList to Hashtable. Avoid clone in CollectIndex().
Sort results in Evaluate() before passing list to ListIterator.
* XslFunctions.cs : removed last ListIterator.ctor() argument.
* XslVariable.cs : removed last ListIterator.ctor() argument.
svn path=/trunk/mcs/; revision=41864
* DefaultContext.cs : Add XPathNavigator input support for ToBoolean()
and ToNavigator().
* Expression.cs : In Equality comparison, evaluate XPathNavigator in
the same as well as NodeSet. This fixes bug #59134.
svn path=/trunk/mcs/; revision=28237
* DefaultContext.cs : Removed MonoTODO. done.
* Expression.cs : handle XPathResultType.Navigator in some places and
removed MonoTODO. Mark MonoTODO with explicit comments (though they
are mostly pointing out possibilities of optimization).
Removed extra check that depended on the old bugs.
* XPathResultType.cs : Fixed .Navigator that had the same value as
.String.
svn path=/trunk/mcs/; revision=27224
* Iterator.cs : Added overriden Count properties for some iterators
(this fixes the half of #50678).
Added ListIterator class (which can reduce GetEnumerator()).
In some places we can omit clone for Current property, so added
some check logic (It has no effect as yet).
* Expression.cs, DefaultContext.cs :
use ListIterator instead of EnumeratorIterator.
svn path=/trunk/mcs/; revision=22934
* DefaultContext.cs : Avoid exception if possible.
* Iterator.cs : Fixed PrecedingSiblingIterator.MoveNext(). When the
nav was positioned at the first, it incorrectly points itself.
Don't add names to name table while it is useless and expensive.
svn path=/trunk/mcs/; revision=22544
* DefaultContext.cs : Overrode all functions' ToString().
XPathFunctions.ToNumber() trims whitespaces at both side.
Fixed NullReferenceException in normalize-space().
* Iterator.cs : Fixed AncestorOrSelfIterator.MoveNext() didn't handle
attribute or namespace node correctly.
SlashIterator.Clone() didn't clone "next node iterator" correctly.
EnumeratorIterator.ctor() should raise an error (not at Clone())
when the target IEnumerator is not ICloneable.
svn path=/trunk/mcs/; revision=20711
* DefaultContext.cs : XPathFunctions.ToNumber() should catch overflow.
XPathFunctionId.cs : Exposed Id expression.
* Expression.cs : Added ExprLiteral.Value, and class ExprParens (it
will be used to solve evaluation precedence problem).
svn path=/trunk/mcs/; revision=20225
* DefaultContext.cs (translate): translate ("abc", "c", "") = "ab"
not "abc".
* Iterator.cs, Expression.cs: All axes are
SimpleIterators. SimpleIterators are gaurenteed to give the same
XPathNavigator in Current. Make AxisIterator take a
SimpleIterator, not any old BaseIterator. Will allow us to make
NameTable optimizations and avoid quite a few strcmp's.
svn path=/trunk/mcs/; revision=18326
* DefaultContext.cs, Expresssion.cs, Parser.jay: Rewrite so that
system functions are actually expressions. Will allow for some
nice optimizations.
svn path=/trunk/mcs/; revision=17947
* DefaultContext.cs: count() should return a double
* Expression.cs: better support for handling non-double numbers
svn path=/trunk/mcs/; revision=16799
* Tokenizer.cs: fix parsing numbers that start with '.'
* DefaultContext.cs: use MS-compatible formatting of doubles
svn path=/trunk/mcs/; revision=7427
* Expression.cs, Parser.jay: allow ExprSLASH to take a generic expression as its left argument.
* Iterator.cs: fix SlashIterator.Clone() when _iterRight is null.
* DefaultContext.cs: fix id() return type.
svn path=/trunk/mcs/; revision=7422