xsl-list
[Top] [All Lists]

Re: [xsl] My XPath mistakenly referenced an element that doesn't exist and I got no error message ... is this bad language design?

2021-10-15 03:08:45
On 14/10/2021 14:45, Roger L Costello costello(_at_)mitre(_dot_)org 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(_at_)antenna(_dot_)co(_dot_)jp


[1] https://www.w3.org/TR/xptr-framework/#scheme
--~----------------------------------------------------------------
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
--~--

<Prev in Thread] Current Thread [Next in Thread>