On 4/17/05, Dimitre Novatchev <dnovatchev(_at_)gmail(_dot_)com> wrote:
On 4/18/05, Lars Marius Garshol <larsga(_at_)garshol(_dot_)priv(_dot_)no>
wrote:
* Dimitre Novatchev
| Cyclomatic Complexity (McCabe) [...]
| Halstead Complexity Measures [...]
| Henry and Kafura metrics [...]
| Bowles metrics [...]
| Troy and Zweben metrics [...]
| Ligier metrics [...]
Those traditional metrics feel unsatisfying for XSLT. They all presume
to be analyzing static program text to produce a single scalar value
called "complexity".
With XSLT, the codepaths are determined by the input, so traditional
complexity analysis doesn't really address the problem. For example,
it's impossible to know if:
<xsl:apply-templates/>
can trigger zero, one or many templates in a stylesheet.
These might all be applicable, but does anyone know of any
implementations of these for XSLT?
I don't know of any implementations for XSLT -- these would be best
implemented as part of an XSLT processor.
This, however, is quite an intriguing idea -- calculate complexity
by tracing stylesheet execution while processing an input document.
Or a series of input documents, varying in complexity. (Of course,
what constitutes "complexity of an XML document" is a separate
discussion. ;-) )
Off the top of my head, here are some things that might contribute to
overall stylesheet complexity:
* number of XSLT modules loaded
* overall size of the XSLT stylesheet loaded
(bytes / nodes post-include, post-import)
* percentage of templates used
* average template size (bytes, nodes, operators, XPath evaluations)
* ratio of input to output size (nodes, bytes)
* percentage of calculated vs. copied output
For example, if I'm processing this DocBook document:
<book/>
I think we can all agree that there are 57 ways to call the DocBook XSL
stylesheets "complex", at least compared to this stylesheet, which
produces the same output:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"/>
:-)
-- Adam
--~------------------------------------------------------------------
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>
--~--