Subject: Re: [xsl] Re: XSLT-driven syntax highlighting for XPath 2.0, XSLT 2.0 and XSD 1.1 From: Dimitre Novatchev <dnovatchev@xxxxxxxxx> Date: Tue, 4 Dec 2012 04:51:53 -0800 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSLT-driven syntax highli, Max Toro | Thread | Re: [xsl] Re: XSLT-driven syntax hi, Philip Fearon |
Re: [xsl] XSLT-driven syntax highli, Philip Fearon | Date | Re: [xsl] Re: XSLT-driven syntax hi, Philip Fearon |
Month |