[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Subject: RE: [relax-ng] Annotations in the non-XML syntax
I think Javadoc encourages coders to document their code better because it is easy to make pretty HTML documentation. We could do something similar by offering (at least informally) some pretty-print stylesheets for pulling a:documentation, DocBook, or XHTML annotations from RELAX NG schema. The attached stylesheet is a meager beginning (revised from my last post on this). I am happy to spend some more time on this, but I need critical comments. Mike -----Original Message----- From: James Clark [mailto:jjc@jclark.com] Sent: Wednesday, March 20, 2002 5:13 AM To: John Cowan; Michael Fitzgerald Cc: RELAX NG List Subject: Re: [relax-ng] Annotations in the non-XML syntax > I'd rather map the # comments into <!-- ... --> comments I will try and do this, though it's not altogether straightforward. However, I feel a little bit uneasy in that it will tend to encourage people to put documentation in comments rather than annotations. I would like to find some way for the non-XML syntax to make it as easy to put documentation in annotations as in comments. James
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://www.w3.org/1999/xhtml"> <xsl:output method="xml" encoding="utf-8" indent="yes"/> <xsl:strip-space elements="*"/> <xsl:param name="title">Documentation</xsl:param> <xsl:template match="/"> <html> <head> <title><xsl:value-of select="$title"/> </title> <style> h1,h2 {font-family:sans-serif} h1{font-size:16pt} h2{font-size:12pt} p {font-family:serif;font-size:12pt;margin-left:20px} </style> </head> <body> <h1><xsl:value-of select="$title"/></h1> <xsl:apply-templates/> </body> </html> </xsl:template> <xsl:template match="value | param"> <p>Param value: <xsl:apply-templates/></p> </xsl:template> <xsl:template match="a:documentation"> <xsl:choose> <xsl:when test="parent::node()[not(name()='element')]"> <h2>Node: <xsl:value-of select="name(preceding-sibling::node())"/></h2> </xsl:when> <xsl:otherwise> <h2>Element: <xsl:value-of select="parent::node()/attribute::name"/></h2> </xsl:otherwise> </xsl:choose> <p><xsl:value-of select="."/></p> </xsl:template> </xsl:stylesheet>
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Powered by eList eXpress LLC