[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Subject: [relax-ng] Stylesheet for a:documentation
I have written a simple XSLT stylesheet for pulling <a:documentation> content from RELAX NG schemas. You can change the content of <title> and <h1> in the XHTML result tree by passing in a parameter value. I would appreciate any comments you have. Mike
<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"> <xsl:apply-templates/> </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