XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] Beware of XPath expressions that produce false positives

yes or I'd write  it as

empty((node,@*)) 

Note as has been discussed <B> </B> is still empty or not depending on the parser, or to put it another way you are testing the result of the parse not the initial lexical xml document.

Also you are classing attributes as non-empty content but not namespace nodes so

<B foo=""/> is non empty but <B xmlns:x="data:,hello"></B> is empty.

David


On 24 September 2016 at 21:00, Costello, Roger L. <costello@mitre.org> wrote:

Hi Folks,

I wrote an XSLT program that evaluates a series of B elements, to see which are empty. The XSLT program tests each B element using this XPath expression:   not(node()) and not(@*)

Here are the results:

 

Is empty?

<B/>

true

<B></B>

true

<B>&null;</B>

true

<B>  </B>

false

<B><!-- Hello, world --></B>

false

<B><bad/></B>

false

<B>99</B>

false

<B x="10"/>

false

 

The XPath seems to be returning results that are consistent with my definition of “empty element.”

/Roger




[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS