[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: My XPath mistakenly referenced an element that do

Subject: Re: My XPath mistakenly referenced an element that doesn't exist and I got no error message ... is this bad language design?
From: "Tony Graham tgraham@xxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 15 Oct 2021 08:08:35 -0000
Re:  My XPath mistakenly referenced an element that  do
On 14/10/2021 14:45, Roger L Costello costello@xxxxxxxxx wrote:
...
I ran the XSLT program on the XML document. No error was generated.

My colleague argues that such behavior is bad language design:
...
Do you agree with my colleague's assessment? Is this behavior in
XPath an indication of bad language design?

That depends on whether or not XPath fulfilled its requirements.


XPath 1.0 codified the intersection between XSLT 1.0 and XPointer.

I can't find a requirements document for XSLT 1.0, but if there was one,
it probably mentioned needing to run in a browser.  At that point, you
generally can't stop and ask for better input.  As it was, the Yellow
Screen of Death (YSoD) from non-well-formed XML soured the use of XML in
the browser for many people.

AFAICT, XPointer generates an error [1] if none of possibly multiple
'pointer parts' identify a subresource but it doesn't matter how many
pointer parts fail before there's one that succeeds.

Later XPath versions would have had a requirement to try to maintain
backwards compatibility.

Hindsight and changed expectations might let us say that of course XPath
should error if there's no match but that we're talking about it on a
mailing list in 2021 instead of in the WG in 1998 suggests that it
wasn't important back then.

Maybe the question is whether (current) XPath was a bad language choice.
Maybe it's whether you should have coded more defensively (as your
colleague pointed out) or (as others pointed out) used more XSLT
features or used other technologies such as Schematron or XSpec tests to
save you from yourself.

Regards,


Tony Graham. -- Senior Architect XML Division Antenna House, Inc. ---- Skerries, Ireland tgraham@xxxxxxxxxxxxx


[1] https://www.w3.org/TR/xptr-framework/#scheme


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.