Structured metadata within XSLT?
I'm interested in adorning stylesheets with structured information about them. For instance, a template might include documentation about its intended usage, structured in such a way that it could be processed by parsing the stylesheet. This could be of great use in providing better tools for using XSLT. AFAIK, the only "official" mechanism for including metadata in a stylesheet is <!-- comment --> This obviously doesn't support XML-based structure within it. I believe that "phantom" unimplemented extension elements can be used to provide structure, if a null <xsl:fallback/> is provided with each use. For example: <xsl:template name="adder"> <xsl:param name="addend1"/> <xsl:param name="addend2"/> <myspace:templateDoc> <!-- myspace is an extension element prefix --> <description>Adds two numbers together.> <params> <param name="addend1" type=xsd:integer>First number to add.</param> <param name="addend2" type=xsd:integer>Second number to add.</param> </params> <result>The sum is output as an integer.</result> <xsl:fallback/> </myspace:templateDoc> <xsl:value-of select="$addend1 + $addend2"/> <!-- much ado about very little --> </xsl:template> I believe this is a hack; I would very much prefer that XSLT provide generic elements specifically for metadata. Something like W3C Schema's <annotation>,<appinfo>, and <documentation> elements would be sufficient; see http://www.w3.org/TR/xmlschema-1/#Annotation_details. I have two questions: 1.) Can anyone see any problems with the extension-element-based usage pattern in the example? 2.) Is anyone on the W3C XSL WG supportive enough of this notion to recommend that the WG add "encapsulating metadata" (or similar) to the XSLT Version 2 requirements? Thanks, -Ed Staub XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format