[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: "Graydon graydon@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 14 Oct 2021 15:25:57 -0000
Re:  My XPath mistakenly referenced an element that  do
On Thu, Oct 14, 2021 at 03:17:08PM -0000, Michael Kay mike@xxxxxxxxxxxx scripsit:
> I've sometimes wondered whether a "soft" checker (lint-like) that warns you of potentially void paths (by reference to a schema and/or instance document) might not be a valuable tool.

Any kind of XSLT linter would be a fine thing to have.

> Or a run-time checker might be less complicated than a compile-time checker: Add an option selection="strict" at the xsl:transform level, and then
> 
> Document/foo is treated as one-or-more(Document)/one-or-more(foo)
> 
> while if you want zero-or-more(Document)/zero-or-more(foo)
> 
> then you have to use some new syntax like opt(Document)/opt(foo)
> 
> Even adding req() as a synonym for one-or-more() might be enough to encourage people to write req(Document)/req(foo) in order to get better diagnostics.

I prefer keeping the default behaviour of the XPath expression and
adding req().  This would be very handy for those "of course there's a
document, wait, oops" expressions.

> Or perhaps a "\" operator that behaves like "/" except the RHS is not allowed to be empty.

Overloading backslash seems a titch rash.  And this would be harder to
read than req() would be.


-- 
Graydon Saunders  | graydonish@xxxxxxxxx
^fs oferiode, pisses swa mfg.
-- Deor  ("That passed, so may this.")

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.