Re: [xsl] XQuery to Report Template Parameters

Subject: Re: [xsl] XQuery to Report Template Parameters
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Sun, 17 Feb 2008 10:21:25 -0500
I can't comment on the XQuery, Eliot ... but your post brought to mind how I use my embedded XSLT documentation methodology called XSLStyle (you can google that or find it in the freely available developer resources from our web site).

I've written in a number of stylesheet writing rules (the "business rules" of writing an XSLT stylesheet) ... including that *all* top-level constructs be separately documented, *all* names of top-level constructs be namespace-qualified (which I have come to believe is a good practice), *all* parameters of functions and templates be documented and have declared types, and many others.

One uses stylesheet association at the top of the top-most XSLT stylesheet in the import tree ... this allows one to drag the XSLT from Windows Explorer onto Internet Explorer and the entire import tree is documented in a single report. Alternatively you can use the stylesheet explicitly in a command line invocation.

The resulting HTML report exposes the documentation of every module and of every top-level construct. It includes an alphabetized index of all named top-level constructs.

Since you were looking for consistency in your task, the aspect of XSLStyle I thought of is the "Inconsistencies Detected" portion of the HTML report, where every violated stylesheet writing rule is reported.

I use XSLStyle to confirm my entire stylesheet library in all imported stylesheet fragments is totally consistent and totally documented before I check in the modules to my source code control system. The effort to keep up the documentation is sometimes a pain, but the end result really helps maintenance and because of enforcing all of the type declarations, I believe it helps the integrity of the stylesheet.

Perhaps there are some ideas in XSLStyle that would help you in determining fault detection with your XQuery.

Oh, one final comment ... XSLStyle is an embedded documentation infrastructure ... the actual documentation constructs themselves are either DITA elements or DocBook elements, your choice. So the end result is an XSLT stylesheet with XSLStyle top-level infrastructure using DITA or DocBook descendants ... producing a Javadoc-like HTML report of the entire stylesheet import/include tree.

I hope this helps.

. . . . . . . . . . . Ken

At 2008-02-17 09:05 -0600, Eliot Kimber wrote:
Here's my first stab at an XQuery to usefully report all the template parameters in a single XSLT module and their uses. This just generates a convenient XML result but it could be reworked to generate an HTML page, which might be more useful. I also wrote it to handle a single file because I didn't have time to figure out how/remember to set a directory as an input parameter via OxygenXML, which is where I developed it.

I certainly claim no special XQuery expertise, so I would also welcome any feedback on the coding of the query itself.

Cheers,

Eliot

----- start of query -----
(: Reports template parameters and their uses.

   This query originally developed by W. Eliot Kimber,
   ekimber at reallysi.com. Feel free to adapt, extend
   or distribute as you choose.
:)


--
World-wide corporate, govt. & user group XML, XSL and UBL training
RSS feeds:     publicly-available developer resources and training
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread