Re: [xsl] Self-analysing stylesheet
At 2008-09-22 17:00 +0200, Detlef Heyn wrote:
I got to do with a very complex stylesheet wich is splitted over
many files in different folders.
This is a common situation when taking advantage of the import and
Now i got a request to let the stylesheet analyse itself by
generating and output wich reflects e.g. wich element-matches are
already implemented, wich attribute-sets, parameters, variables and
named templates do exist.
In 2005 I published XSLStyle on our web site. The home page link
below to "Free resources", or Google, will get you to it.
This is a scaffold vocabulary for XSLT stylesheets used to contain
documentation about all top-level constructs in an amalgamated XSLT
stylesheet of all imported and included modules.
With the top-most importing fragment, using either a standalone XSLT
processor or by dragging it to a web browser, XSLStyle produces a
complete HTML report of the entire tree and its constructs. All
template rules require all parameters to be documented. At the end
of the report is an alphabetized listing of all named top-level
constructs, indicating in which module the construct the construct
can be found. It is all hyperlinked to promote easy navigation
around the information.
By enforcing what I think are good stylesheet writing practices,
developers continue adding documentation until the stylesheet reports
no inconsistencies or missing components. On some projects this has
been a gating factor to allowing modules to be updated in a source
code control system.
As XSLStyle is only scaffolding for documentation, the documentation
you write can be in any vocabulary. I've included both DocBook and
DITA as choices in the download. On one project, where the
stylesheets formatted a custom publishing vocabulary, we used the
vocabulary itself for the XSLT documentation. This was, then, quite
recursive: the documentation for the stylesheet used the stylesheet
itself to get rendered.
I tried some things already with sometimes surprisingly results but
I'm still more than far away from my aim.
Im afraid that i miss the right starting point for an gratifying solution yet.
If anyone could help me to find the right entrie for the solution
with a little example - i would be very glad.
XSLStyle is free to download and use. I think you'll find it a very
complete solution to documenting fragmented XSLT stylesheets. Any
suggestions for improvements are welcome, and of course you can go in
and hack your own additional rules or remove rules you don't like.
I hope this helps.
. . . . . . . . . . . Ken
Upcoming XSLT/XSL-FO hands-on courses: Wellington, NZ 2009-01
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal