[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Does it make sense to collect elements with a cert
> To my way of thinking, there is no benefit. I collected <row> elements with a matching ARPT_IDENT, then the assert tests that the collected <row> elements have a matching ARPT_IDENT. The assert seems pointless/redundant/useless/wasteful. Am I missing something? > That's surely the whole point of asserts. You typically assert that `exists($doc//title)` if (a) you are absolutely sure this is going to be true, and (b) it's not immediately obvious to everyone that it will always be true. An assert always asserts something that you are confident will be true, but where your confidence is the result of some non-trivial reasoning process. It's there for two reasons: (a) so that the computer can tell you if your confidence turns out to be misplaced, and (b) so that readers of the code can see what's going on without having to repeat your reasoning process. Well, actually, there is another reason to use assertions, namely to test for external conditions that you want to treat as fatal. For example the assertion test="doc-available('input.xml')" is there not because you're certain it will always be true, but because you want to abort processing if it isn't. But assertions aren't actually the ideal mechanism for that, because they are often switched off by default when running in production. Michael Kay Saxonica
|
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
|