[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
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.... 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,
[1] https://www.w3.org/TR/xptr-framework/#scheme
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|