xsl-list
[Top] [All Lists]

Re: [xsl] Avoiding boneheaded mistakes in XSLT?

2010-12-30 03:52:16
Rather than asking for an ad-hoc solution for this or that: XSLT might
very well, by definition in the language and not as a vendor
extension, provide a general mechanism for implementing safeguards for
many situations. (I haven't thought long about this, so forgive me if
it's already out there or has a serious flaw.)

A new XSLT-element:
   <xsl:hook name = expression >...</xsl-hook>

This new element xsl:hook is called (as if it were a named template)
whenever a <xsl:instr-name> instruction is executed. Within its body,
a function hook-attr( "attr-name" ) can be used to access the actual
values of <xsl:instr-name>. Also, hook-line() might be useful, and, if
a general @id were permitted for every <xsl:*>, hook-id() could be
used to filter certain instantiations of the category.

Happy New Year (and thank you all for the help)
Wolfgang

On 30 December 2010 10:05, Dave Pawson <davep(_at_)dpawson(_dot_)co(_dot_)uk> 
wrote:
On Wed, 29 Dec 2010 23:49:53 -0500
Graydon <graydon(_at_)marost(_dot_)ca> wrote:

Even without schema awareness/context, surely the processor can
tell when an xpath expression will result in zero match?

But a zero match is completely legitimate, isn't it?

If I'm matching on para/b, and much of my input doesn't have it, and
some of it does, I shouldn't get a warning because I'm looking for
something that isn't in this particular input file.

Or am I completely mis-understanding what you want, there?


Agreed, there are cases where this might be wanted as a response
from an xpath expression. Hence a warning. Hence 'not all the time'.

But consider the typo that we all make from time to time .... to time.
If it can help find that, it helps debugging.

Once you've stared at a stylesheet for minutes on end and read what
you thought you wrote, rather than what you actually wrote....
Then any debug info helps!


--

regards

--
Dave Pawson
XSLT XSL-FO FAQ.
http://www.dpawson.co.uk

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--