[
http://opensource.atlassian.com/projects/hibernate/browse/ANN-537?page=co...
]
Peter Hilton commented on ANN-537:
----------------------------------
Meanwhile, I have a work-around: generate the HTML documentation and then use XSLT to add
the column descriptions.
First, I define the comments in an XML file, where the id attributes are table names and
column names.
<?xml version="1.0" encoding="UTF-8"?>
<column-descriptions>
<table id="customers">
<column id="customer_id">Primary key</column>
<!-- more columns -->
</table>
<!-- more tables -->
</column-descriptions>
Then I transform each generated table_name.html file with the following XSL 2.0
stylesheet. XSL version 2 is required, to have multiple source documents.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml"
xpath-default-namespace="http://www.w3.org/1999/xhtml">
<xsl:output method="xhtml" doctype-public="-//W3C//DTD XHTML 1.0
Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" />
<!-- Identity transformation. -->
<xsl:template match="node()">
<xsl:copy>
<xsl:copy-of select="@*" />
<xsl:apply-templates />
</xsl:copy>
</xsl:template>
<!-- Column detail section: copy the heading, then output a paragraph containing the
column description from column-descriptions.xml. -->
<xsl:template match="h3">
<xsl:copy-of select="."/>
<xsl:variable name="table" select="substring(/html/body/h2[1],
7)"/>
<xsl:variable name="column" select="substring(@id , 15)"/>
<p><xsl:value-of
select="document('column-descriptions.xml')//*[@id=$table]/*[@id=$column]"/></p>
</xsl:template>
</xsl:transform>
The easiest way to run this is to use Saxon-B 9.0 (
http://saxon.sourceforge.net/) and the
following Ant task.
<xslt style="source/column-descriptions.xsl"
basedir="build/hbm2doc/tables" destdir="build/documentation"
force="yes">
<classpath location="lib/saxonb9-0-0-2j/saxon9.jar"/>
<include name="**/*.html" />
</xslt>
Also, while I am at it, I added templates to the XSL stylesheet to replace the HTML LINK
element so I can point to my own stylesheet.
Support @Comment or column attribute on @Table and @Column
----------------------------------------------------------
Key: ANN-537
URL:
http://opensource.atlassian.com/projects/hibernate/browse/ANN-537
Project: Hibernate Annotations
Issue Type: Improvement
Components: binder
Affects Versions: 3.2.1
Reporter: Max Rydahl Andersen
with hbm2ddl and hbm2doc its a shame that Annotation does not support setting a comment
on table and columns.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira