- From: Josh Matthews <joshmatthews@gmail.com>
- Date: Sat, 4 Oct 2008 22:14:31 -0400
- To: mozer <xmlizer@gmail.com>
- Cc: "Norman Walsh" <ndw@nwalsh.com>, "XProc Dev" <xproc-dev@w3.org>
- Message-ID: <ffee23380810041914x26d236c8r4831be87251a0287@mail.gmail.com>
I disagree. In my opinion, one of the primary advantages of XML is its ability to handle flexible cases like this in a sane, flexible manner - that means not throwing errors on arguably sane input. Why is the below case "arguably sane"? Well, say you have: <p:delete name="step1"> <p:with-option name="match" select="//a"/> </p:delete> (which was, in fact, the original example - but say the intention in this case was really to populate the value of the match option from the result of evaluating the XPath expression "//a"). Imagine //a matched nothing in the document - which is certainly sane, and is a consequence of the flexible XML data model (you can imagine some documents with an "a" element and others without, but you want your pipeline to process both). In that case, the above is equivalent to: <p:delete match=""/> which means it just shouldn't delete anything at all, not raise an error! It would be a shame if you'd have to wrap all calls to <p:delete> that have a <p:with-option name="match" select="some-expression"> in a <p:choose> to ensure that "some-expression" actually has a result, or wrap in a <p:try> to catch the potential error. You really would have to do one of those two things to guarantee your pipeline succeeds on flexible input. (That said, an argument could be made to the contrary: the spec reads "It is a dynamic error (err:XD0019) if any option value does not satisfy the type required for that option". The required type for the match option on p:delete is XSLTMatchPattern (the formal definition of which is, I assume, the "Pattern" construct in the XSLT spec), which does not allow an empty string. Even so, I'd still argue that the above use case is possible, sane, and shouldn't result in an error). Cheers, Josh Matthews On Sat, Oct 4, 2008 at 3:58 PM, mozer <xmlizer@gmail.com> wrote: > > Well, I would say that if you want to match nothing you do > match="/.." > > I think match="" should trigger a dynamic error > > Xmlizer > > On Sat, Oct 4, 2008 at 9:50 PM, Norman Walsh <ndw@nwalsh.com> wrote: > > mozer <xmlizer@gmail.com> writes: > > > >> well the bug in your code (but probably there is also a bug in Calabash) > :) > > > > Heh. Thanks. :-) > > > > I actually can't decide if this is a bug or not. > > > > Is this allowed? > > > > <p:delete match=""/> > > > > Is that an error, or is that just a p:delete that won't match > > anything? > > > > Be seeing you, > > norm > > > > -- > > Norman Walsh <ndw@nwalsh.com> | Human felicity is produced not so much > > http://nwalsh.com/ | by great pieces of good fortune that > > | seldom happen, as by little advantages > > | that occur every day.--Benjamin Franklin > > > >
Received on Sunday, 5 October 2008 02:20:24 UTC