Re: [xsl] Re: XSLT-driven syntax highlighting for XPath 2.0, XSLT 2.0 and XSD 1.1

Subject: Re: [xsl] Re: XSLT-driven syntax highlighting for XPath 2.0, XSLT 2.0 and XSD 1.1
From: Philip Fearon <pgfearo@xxxxxxxxxxxxxx>
Date: Tue, 4 Dec 2012 13:37:31 +0000
Some good ideas here - yes, it would be good to discourage reuse of
element names as variable names. This kind of thing is probably best
provided as an option though. Graph traversal will be an interesting
challenge, but I think this is something XSLT should be well suited
to.

After workin on PathEnq's XPath debugger (this XSLT is a spin-off
really - which is why there's a lot of unused metadata on elements), I
have many ideas on how the dynamic behaviour of the HTML can be
improved (when you hover over elements etc) using either JavaScript or
Saxon-CE, but I know I need to focus on getting the static parts right
first.

Thanks

Phil

On Tue, Dec 4, 2012 at 12:51 PM, Dimitre Novatchev <dnovatchev@xxxxxxxxx> wrote:
> On Fri, Nov 30, 2012 at 5:57 AM, Philip Fearon <pgfearo@xxxxxxxxxxxxxx> wrote:
>>> As
>>> we all too-well know one of the most frequent and most difficult to
>>> detect programming error is failing to precede a (what must be a)
>>> variable reference with the '$' character. I would like any such
>>> occurence to be hi-lighted in bold red, and in addition, even
>>> flashing. Just implementing this will save many hours of confusion to
>>> us all.
>>
>> I agree this would be most useful as I often find I've omitted the '$' myself.
>> Though this would be a simplistic approach I guess the easiest thing
>> would be to just
>> have a key holding all the permitted element names (even ignoring namespaces)
>> and for each apparent element name found in the expression check for a match.
>
> I thought of something even more simple:
>
> Error-highlight a name if it isn't starting with the '$' character and
> there is a variable defined with the same name.
>
> Even if this is not an error (a node with the same name exists in the
> set of documents being processed), this would be a good warning that
> it would be a good idea to change the name of the same-named variable
> to something more safe.
>
> This can be done easily for a primary stylesheet that doesn't
> import/include other stylesheets. Importing/including can be added as
> a second stage by implementing a graph traversal whete the nodes are
> the stylesheet modules and the arcs are the import/include
> relationships.
>
>
> --
> Cheers,
> Dimitre Novatchev
> ---------------------------------------
> Truly great madness cannot be achieved without significant intelligence.
> ---------------------------------------
> To invent, you need a good imagination and a pile of junk
> -------------------------------------
> Never fight an inanimate object
> -------------------------------------
> To avoid situations in which you might make mistakes may be the
> biggest mistake of all
> ------------------------------------
> Quality means doing it right when no one is looking.
> -------------------------------------
> You've achieved success in your field when you don't know whether what
> you're doing is work or play
> -------------------------------------
> Facts do not cease to exist because they are ignored.
> -------------------------------------
> Typing monkeys will write all Shakespeare's works in 200yrs.Will they
> write all patents, too? :)
> -------------------------------------
> I finally figured out the only reason to be alive is to enjoy it.

Current Thread