From: <bob...@us...> - 2011-10-30 03:42:19
|
Revision: 9140 http://docbook.svn.sourceforge.net/docbook/?rev=9140&view=rev Author: bobstayton Date: 2011-10-30 03:42:11 +0000 (Sun, 30 Oct 2011) Log Message: ----------- Now handles caption in html markup table like title, so formal.object.title is used with all its features, including formatting and placement. Added htmlTable.with.caption template to handle the wrapper, and left htmlTable template unchanged. Now caption template in mode="htmlTable" does nothing, because caption handled by formal.object.title template. Modified Paths: -------------- trunk/xsl/html/formal.xsl trunk/xsl/html/htmltbl.xsl Modified: trunk/xsl/html/formal.xsl =================================================================== --- trunk/xsl/html/formal.xsl 2011-10-29 15:41:58 UTC (rev 9139) +++ trunk/xsl/html/formal.xsl 2011-10-30 03:42:11 UTC (rev 9140) @@ -197,6 +197,9 @@ <xsl:when test="tgroup|mediaobject|graphic"> <xsl:call-template name="calsTable"/> </xsl:when> + <xsl:when test="caption"> + <xsl:call-template name="htmlTable.with.caption"/> + </xsl:when> <xsl:otherwise> <!-- do not use xsl:copy because of XHTML's needs --> <xsl:element name="table" namespace=""> @@ -210,6 +213,87 @@ </xsl:choose> </xsl:template> +<!-- Handle html markup table like formal.object --> +<xsl:template name="htmlTable.with.caption"> + <xsl:param name="class"> + <xsl:apply-templates select="." mode="class.value"/> + </xsl:param> + + <xsl:variable name="param.placement" + select="substring-after(normalize-space($formal.title.placement), + concat(local-name(.), ' '))"/> + + <xsl:variable name="placement"> + <xsl:choose> + <xsl:when test="contains($param.placement, ' ')"> + <xsl:value-of select="substring-before($param.placement, ' ')"/> + </xsl:when> + <xsl:when test="$param.placement = ''">before</xsl:when> + <xsl:otherwise> + <xsl:value-of select="$param.placement"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:call-template name="id.warning"/> + + <xsl:variable name="content"> + <div class="{$class}"> + <xsl:call-template name="anchor"> + <xsl:with-param name="conditional" select="0"/> + </xsl:call-template> + + <xsl:choose> + <xsl:when test="$placement = 'before'"> + + <xsl:call-template name="formal.object.heading"/> + + <div class="{$class}-contents"> + <xsl:apply-templates select="." mode="htmlTable"/> + </div> + + <xsl:call-template name="table.longdesc"/> + + <xsl:if test="$spacing.paras != 0"><p/></xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:if test="$spacing.paras != 0"><p/></xsl:if> + + <div class="{$class}-contents"> + <xsl:apply-templates select="." mode="htmlTable"/> + </div> + + <xsl:call-template name="table.longdesc"/> + + <xsl:call-template name="formal.object.heading"/> + </xsl:otherwise> + </xsl:choose> + </div> + <xsl:if test="not($formal.object.break.after = '0')"> + <br class="{$class}-break"/> + </xsl:if> + </xsl:variable> + + <xsl:variable name="floatstyle"> + <xsl:call-template name="floatstyle"/> + </xsl:variable> + + <xsl:choose> + <xsl:when test="$floatstyle != ''"> + <xsl:call-template name="floater"> + <xsl:with-param name="class"><xsl:value-of + select="$class"/>-float</xsl:with-param> + <xsl:with-param name="floatstyle" select="$floatstyle"/> + <xsl:with-param name="content" select="$content"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:copy-of select="$content"/> + </xsl:otherwise> + </xsl:choose> + +</xsl:template> + <xsl:template name="calsTable"> <xsl:if test="tgroup/tbody/tr |tgroup/thead/tr Modified: trunk/xsl/html/htmltbl.xsl =================================================================== --- trunk/xsl/html/htmltbl.xsl 2011-10-29 15:41:58 UTC (rev 9139) +++ trunk/xsl/html/htmltbl.xsl 2011-10-30 03:42:11 UTC (rev 9140) @@ -14,6 +14,16 @@ <!-- ==================================================================== --> +<xsl:template match="table" mode="htmlTable"> + <xsl:element name="table" namespace=""> + <xsl:apply-templates select="@*" mode="htmlTableAtt"/> + <xsl:attribute name="id"> + <xsl:call-template name="object.id"/> + </xsl:attribute> + <xsl:call-template name="htmlTable"/> + </xsl:element> +</xsl:template> + <xsl:template match="colgroup" mode="htmlTable"> <xsl:element name="{local-name()}" namespace=""> <xsl:apply-templates select="@*" mode="htmlTableAtt"/> @@ -27,18 +37,9 @@ </xsl:element> </xsl:template> -<xsl:template match="caption" mode="htmlTable"> - <!-- do not use xsl:copy because of XHTML's needs --> - <caption> - <xsl:apply-templates select="@*" mode="htmlTableAtt"/> +<!-- Handled by formal.object.title template --> +<xsl:template match="caption" mode="htmlTable"/> - <xsl:apply-templates select=".." mode="object.title.markup"> - <xsl:with-param name="allow-anchors" select="1"/> - </xsl:apply-templates> - - </caption> -</xsl:template> - <xsl:template match="tbody|thead|tfoot|tr" mode="htmlTable"> <xsl:element name="{local-name(.)}"> <xsl:apply-templates select="@*" mode="htmlTableAtt"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |