Subject: Re: [xsl] 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 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] My XPath mistakenly refer, Michael Kay mike@xxx | Thread | Re: [xsl] My XPath mistakenly refer, David Birnbaum djbpi |
Re: [xsl] My XPath mistakenly refer, Michael Kay mike@xxx | Date | Re: [xsl] My XPath mistakenly refer, David Birnbaum djbpi |
Month |