【问题】
将docbook的xsl从docbook-xsl-ns-1.76.1升级到了最新的docbook-xsl-ns-1.77.0,但却导致html中revhistory的内容部分,单元格无边框。
之前是有边框的:
现在新的却没有了:
想要把边框弄回来。
【解决过程】
1.去对比了相关的html的源码。
旧的是:
<div><div class="revhistory"><table border="1" width="100%" summary="Revision history">
<tr><th align="left" valign="top" colspan="3"><b>修订历史</b></th></tr>
<tr>
<td align="left">修订 0.1</td>
<td align="left">2012-06-01</td>
<td align="left">crl</td>
</tr>
<tr><td align="left" colspan="3">
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">完成此文逻辑框架</li></ol></div>
</td></tr>
</table></div></div>新的是:
<div><div class="revhistory"><table style="border-style:solid; width:100%;" summary="修订历史">
<tr><th align="left" valign="top" colspan="3"><b>修订历史</b></th></tr>
<tr>
<td align="left">修订 0.1</td>
<td align="left">2012-06-01</td>
<td align="left">crl</td>
</tr>
<tr><td align="left" colspan="3">
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">完成此文逻辑框架</li></ol></div>
</td></tr>
</table></div></div>很明显,新的html源码中,table的属性,写成了style=xxx的形式,而不是之前正常的单独border,width等属性的设置了。
所以,现在就是要去搞清楚,到底哪里的xsl配置改变了,而导致此问题的。
2.找了很长的时间,最后终于是通过:
中的log中有提到revhistory.table.cell.properties,然后搜到
HTML output for revhistory,然后才找到docbook-xsl-ns-1.77.0\html\titlepage.xsl的真正去格式化revhistory的设置的:
可见,新版的xsl中,加入了一堆的设置,但是结果生成的
<table style="border-style:solid; width:100%;"
却无法正常工作,而旧版的固定的配置:
border="1" width="100%"
却是可以正常工作的。
3.后经过自己手动去修改table的属性,测试结果证明,其实上述的
<table style="border-style:solid; width:100%;"
是可以工作的,但只是少了个border="1" ,导致没有边框,加上此配置,就可以生成带边框的revhistory了。
所以,剩下的就是去找到到底是如何加此配置比较合适。
4.最后是把相关的配置拷贝过来,然后增加了border和width的配置,如下:
<!--============================================================================
revhistory table setting
=============================================================================-->
<!--
from docbook-xsl-ns-1.77.0\html\titlepage.xsl
has refer: http://www.w3school.com.cn/css/css_table.asp, but 'solid' not work
-->
<xsl:template match="d:revhistory" mode="titlepage.mode">
<xsl:variable name="numcols">
<xsl:choose>
<xsl:when test=".//d:authorinitials|.//d:author">3</xsl:when>
<xsl:otherwise>2</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
<xsl:variable name="title">
<xsl:call-template name="gentext">
<xsl:with-param name="key">RevHistory</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="contents">
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<table>
<xsl:if test="$css.decoration != 0">
<!-- changed by crifan start -->
<!--
<xsl:attribute name="style">
<xsl:text>border-style:solid; width:100%;</xsl:text>
</xsl:attribute>
-->
<xsl:attribute name="border">
<xsl:text>1px solid black</xsl:text>
</xsl:attribute>
<xsl:attribute name="width">
<xsl:text>100%</xsl:text>
</xsl:attribute>
<!-- changed by crifan end -->
</xsl:if>
<!-- include summary attribute if not HTML5 -->
<xsl:if test="$div.element != 'section'">
<xsl:attribute name="summary">
<xsl:call-template name="gentext">
<xsl:with-param name="key">revhistory</xsl:with-param>
</xsl:call-template>
</xsl:attribute>
</xsl:if>
<tr>
<th align="{$direction.align.start}" valign="top" colspan="{$numcols}">
<b>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'RevHistory'"/>
</xsl:call-template>
</b>
</th>
</tr>
<xsl:apply-templates mode="titlepage.mode">
<xsl:with-param name="numcols" select="$numcols"/>
</xsl:apply-templates>
</table>
</div>
</xsl:variable>
<xsl:choose>
<xsl:when test="$generate.revhistory.link != 0">
<!-- Compute name of revhistory file -->
<xsl:variable name="file">
<xsl:call-template name="ln.or.rh.filename">
<xsl:with-param name="is.ln" select="false()"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="filename">
<xsl:call-template name="make-relative-filename">
<xsl:with-param name="base.dir" select="$chunk.base.dir"/>
<xsl:with-param name="base.name" select="$file"/>
</xsl:call-template>
</xsl:variable>
<a href="{$file}">
<xsl:copy-of select="$title"/>
</a>
<xsl:call-template name="write.chunk">
<xsl:with-param name="filename" select="$filename"/>
<xsl:with-param name="quiet" select="$chunk.quietly"/>
<xsl:with-param name="content">
<xsl:call-template name="user.preroot"/>
<html>
<head>
<xsl:call-template name="system.head.content"/>
<xsl:call-template name="head.content">
<xsl:with-param name="title">
<xsl:value-of select="$title"/>
<xsl:if test="../../d:title">
<xsl:value-of select="concat(' (', ../../d:title, ')')"/>
</xsl:if>
</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="user.head.content"/>
</head>
<body>
<xsl:call-template name="body.attributes"/>
<xsl:copy-of select="$contents"/>
</body>
</html>
<xsl:text>
</xsl:text>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$contents"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>即可。
转载请注明:在路上 » 【已解决】新的docbook-xsl-ns-1.77.0生成的html中的revhistory中单元格无边框

