xsl-list
[Top] [All Lists]

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

2012-12-04 06:52:33
On Fri, Nov 30, 2012 at 5:57 AM, Philip Fearon 
<pgfearo(_at_)googlemail(_dot_)com> 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.

--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>