From: "Meer, Hans van der" <H.vanderMeer@uva.nl>
To: NTG ConTeXt <ntg-context@ntg.nl>
Subject: evaluation of != and ~=
Date: Fri, 29 Apr 2016 15:26:12 +0000 [thread overview]
Message-ID: <7E62C0D8-6E69-4870-9057-7F76580CE5E6@uva.nl> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 1372 bytes --]
This one took the better part of an afternoon from me, but I finally found the (unexpected) culprit.
In the xml documentation on page 31 it is said:
The given expression between [] is converted to a LUA expression so you can use the use operators: == ~= <= >= < > not and or ()
In addition, = equals == and != is the same as ~=.
This is not true as the following demonstrates. The use of != is as expected but the ~= leads to an error and this should not be:
xml> lpath > error in expression: number(@atta) ~= 1 => expr.number((ll.at<http://ll.at> and ll.at<http://ll.at>['atta'])) ~== 1
Hans van der Meer
% failure of test on inequality.
\startxmlsetups demo:comparefail
\xmlsetsetup{#1}{root|node}{demo:comparefail:*}
\stopxmlsetups
\xmlregisterdocumentsetup{demo}{demo:comparefail}
\startxmlsetups demo:comparefail:root
compare \type{!=}\crlf
\xmlfilter{#1}{/[number(@atta) != 1]/command(demo:comparefail:node)}
compare \type{~=}\crlf
\xmlfilter{#1}{/[number(@atta) ~= 1]/command(demo:comparefail:node)}
\stopxmlsetups
\startxmlsetups demo:comparefail:node
node: attribute atta = \xmlatt{#1}{atta}\crlf
\stopxmlsetups
\startbuffer[comparefail]
<root>
<node atta="2"/>
<node atta="1"/>
</root>
\stopbuffer
\starttext
\xmlprocessbuffer{demo}{comparefail}{}
Note the absence of output in the second \tex{xmlfilter}.
\stoptext
[-- Attachment #1.2: Type: text/html, Size: 3958 bytes --]
[-- Attachment #2: xml-compare.pdf --]
[-- Type: application/pdf, Size: 8931 bytes --]
[-- Attachment #3: Type: text/plain, Size: 485 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
reply other threads:[~2016-04-29 15:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7E62C0D8-6E69-4870-9057-7F76580CE5E6@uva.nl \
--to=h.vandermeer@uva.nl \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).