Re: [xml] PATCH: XPath eq and neq operators (NON STANDARD ?)



On Thu, 2007-11-01 at 14:13 -0300, pwhelan wrote:

This patch adds support for the 'eq' and 'neq' operators, in a way so that 
they are just aliases for the '=' and '!=' operators.

You might do better to consider using internal entities

<!ENTITY eq '='>
<!ENTITY neq '!='>

and doing, e.g.
    <xsl:value-of select="/socks/argyle[ holecount &eq; 0]" />

Using eq and expecting it to be the same as = is asking for
trouble if you use other XSLT implementations, as they move
towards XPath 2.0 and XSLT 2.0, where eq and ne have meanings
that are subtly different from = and != as follows:
eq, ne, lt, le, gt, and ge work on singleton values, and
do not perform implicit existential quantification, and
hence are transitive.  In English, you can use = and !=
with one or both arguments ("operands") being a sequence,
but it is an error if eq or ne is given a sequence.

In XPath 1, eq, ne etc. are not defined as operators.
Please don't try to extend XPath in this way.  use
entities as I outlined above, or make functions,
my:ne(v1, v2), ny:neq(v1, v2) idenfitied as belonging
to a namespace you define.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]