On 22 September 2016 at 23:12, Graydon graydon(_at_)marost(_dot_)ca
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:
On Thu, Sep 22, 2016 at 04:01:39PM -0000, G. Ken Holman
g(_dot_)ken(_dot_)holman(_at_)gmail(_dot_)com scripsit:
At 2016-09-22 15:55 +0000, Costello, Roger L. costello(_at_)mitre(_dot_)org
wrote:
I want an XPath 2.0 expression that outputs "do action" if the B field
is empty, regardless of which of the two XML representations is used.
This XPath expression seems to work:
if (not(B) or B eq '') then "do action" else "no action"
This gives you the same result:
if (not(string(B))) then "do action" else "no action"
You could also use
if (not(boolean(B))) then "do action" else "no action"
which exploits empty strings being false().
no, to get the string behaviour need the version you quoted with not(string(B))
not(boolean(B)) is the same as not(B) and (in the absence of schema typing)
is false if B is present but empty.
David
Though that's definitely the sort of logic that should get a comment
explaining to your future self what you're going.
-- Graydon
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--