You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ch...@apache.org on 2011/06/08 22:26:53 UTC
svn commit: r1133549 - /db/derby/docs/trunk/lib/dita2htmlImpl.xsl
Author: chaase3
Date: Wed Jun 8 20:26:53 2011
New Revision: 1133549
URL: http://svn.apache.org/viewvc?rev=1133549&view=rev
Log:
DERBY-5255 Fix more difficult table problems
This patch modifies the lib/dita2htmlImpl.xsl to provide table summaries and valid headers attributes in table rows.
Patches: DERBY-5255.diff
Modified:
db/derby/docs/trunk/lib/dita2htmlImpl.xsl
Modified: db/derby/docs/trunk/lib/dita2htmlImpl.xsl
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/lib/dita2htmlImpl.xsl?rev=1133549&r1=1133548&r2=1133549&view=diff
==============================================================================
--- db/derby/docs/trunk/lib/dita2htmlImpl.xsl (original)
+++ db/derby/docs/trunk/lib/dita2htmlImpl.xsl Wed Jun 8 20:26:53 2011
@@ -1396,7 +1396,19 @@
<xsl:call-template name="flagit"/>
<xsl:call-template name="start-revflag"/>
<xsl:call-template name="setaname"/>
- <table cellpadding="4" cellspacing="0" summary="">
+
+ <!-- Fix this; this table has no summary -->
+
+
+
+ <table cellpadding="4" cellspacing="0">
+
+ <xsl:attribute name="summary">
+ <xsl:call-template name="CREATE-CAPTION-TEXT"/>
+ </xsl:attribute>
+
+
+
<xsl:variable name="colsep">
<xsl:choose>
<xsl:when test="*[contains(@class,' topic/tgroup ')]/@colsep"><xsl:value-of select="*[contains(@class,' topic/tgroup ')]/@colsep"/></xsl:when>
@@ -1984,7 +1996,8 @@
</xsl:if>
</xsl:variable>
<xsl:if test="string-length($rowheader)>0 or string-length($hdrattr)>0">
- <xsl:attribute name="headers"><xsl:value-of select="$rowheader"/><xsl:value-of select="$hdrattr"/></xsl:attribute>
+ <!-- <xsl:attribute name="headers"><xsl:value-of select="$rowheader"/><xsl:value-of select="$hdrattr"/></xsl:attribute> -->
+ <xsl:attribute name="headers"><xsl:value-of select="normalize-space($rowheader)"/><xsl:value-of select="normalize-space($hdrattr)"/></xsl:attribute>
</xsl:if>
</xsl:template>
@@ -2063,7 +2076,16 @@
<xsl:call-template name="flagit"/>
<xsl:call-template name="start-revflag"/>
<xsl:call-template name="setaname"/>
- <table cellpadding="4" cellspacing="0" summary="">
+
+ <!-- Fix this; this table has no summary -->
+
+ <table cellpadding="4" cellspacing="0">
+ <xsl:attribute name="summary">
+ <xsl:call-template name="CREATE-CAPTION-TEXT"/>
+ </xsl:attribute>
+
+
+
<xsl:call-template name="setid"/>
<xsl:choose>
<xsl:when test="@frame='none'">
@@ -2164,9 +2186,9 @@
<!-- If there is a keycol header or an sthead header, create the attribute -->
<xsl:if test="string-length($header)>0 or string-length($keycolhead)>0">
<xsl:attribute name="headers">
- <xsl:value-of select="$header"/>
- <xsl:if test="string-length($header)>0 and string-length($keycolhead)>0"><xsl:text> </xsl:text></xsl:if>
- <xsl:value-of select="$keycolhead"/>
+ HEADER VAR[<xsl:value-of select="$header"/>]
+ <xsl:if test="string-length($header)>0 and string-length($keycolhead)>0"><xsl:text>THIS TEXT SHOULD NOT BE HERE</xsl:text></xsl:if>
+ KEYCOLHEAD VAR[<xsl:value-of select="$keycolhead"/>]
</xsl:attribute>
</xsl:if>
</xsl:if>
@@ -3439,6 +3461,61 @@
</xsl:if>
</xsl:template>
+<xsl:template name="CREATE-CAPTION-TEXT">
+ <xsl:param name="stringName"/>
+ <xsl:variable name="tbl-count"> <!-- Number of table/title's before this one -->
+ <xsl:number count="*/*[contains(@class,' topic/table ')]/*[contains(@class,' topic/title ')]" level="any"/>
+ </xsl:variable>
+
+ <xsl:variable name="tbl-count-actual"> <!-- Number of table/title's including this one -->
+ <xsl:choose> <!-- init table counter to 1 - if not set -->
+ <xsl:when test="not($tbl-count>0) and not($tbl-count=0) and not($tbl-count<0)">1</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$tbl-count+1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable> <!-- normally: "Table 1. " -->
+
+ <xsl:variable name="ancestorlang">
+ <xsl:call-template name="getLowerCaseLang"/>
+ </xsl:variable>
+
+ <xsl:choose>
+
+ <!-- title -or- title & desc -->
+ <xsl:when test="*[contains(@class,' topic/title ')]">
+ <xsl:choose> <!-- Hungarian: "1. Table " -->
+ <xsl:when test="( (string-length($ancestorlang)=5 and contains($ancestorlang,'hu-hu')) or (string-length($ancestorlang)=2 and contains($ancestorlang,'hu')) )">
+ <!-- Change all value-of to concat($CAPTION-TEXT, ...) -->
+ <xsl:value-of select="$tbl-count-actual"/><xsl:text>. </xsl:text>
+ <xsl:call-template name="getString">
+ <xsl:with-param name="stringName" select="'Table'"/>
+ </xsl:call-template><xsl:text> </xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="getString">
+ <xsl:with-param name="stringName" select="'Table'"/>
+ </xsl:call-template><xsl:text> </xsl:text><xsl:value-of select="$tbl-count-actual"/><xsl:text>. </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:apply-templates select="./*[contains(@class,' topic/title ')]" mode="tabletitle"/>
+ <xsl:if test="*[contains(@class,' topic/desc ')]">
+ <xsl:text>. </xsl:text>
+ <xsl:apply-templates select="./*[contains(@class,' topic/desc ')]" mode="tabledesc"/>
+ </xsl:if>
+ </xsl:when>
+
+ <!-- desc -->
+ <xsl:when test="*[contains(@class,' topic/desc ')]">
+ <xsl:apply-templates select="./*[contains(@class,' topic/desc ')]" mode="tabledesc"/>
+ </xsl:when>
+
+ </xsl:choose>
+
+</xsl:template>
+
+
<!-- table caption -->
<xsl:template name="place-tbl-lbl">
<xsl:param name="stringName"/>