~ubuntu-branches/ubuntu/trusty/yelp-xsl/trusty

« back to all changes in this revision

Viewing changes to xslt/docbook/html/db2html-table.xsl

  • Committer: Package Import Robot
  • Author(s): Michael Biebl
  • Date: 2013-10-17 00:05:53 UTC
  • mto: This revision was merged to the branch mainline in revision 19.
  • Revision ID: package-import@ubuntu.com-20131017000553-4rje2hk2j69y05w4
Tags: upstream-3.10.1
ImportĀ upstreamĀ versionĀ 3.10.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
  <xsl:param name="rowsep" select="''"/>
51
51
  <xsl:param name="spanstr"/>
52
52
  <tr>
53
 
    <xsl:if test="($row/../self::tbody and (count($row/preceding-sibling::row) mod 2 = 1)) or
54
 
                  ($row/../self::db:tbody and (count($row/preceding-sibling::db:row) mod 2 = 1))">
55
 
      <xsl:attribute name="class">
56
 
        <xsl:text>shade</xsl:text>
57
 
      </xsl:attribute>
58
 
    </xsl:if>
 
53
    <xsl:call-template name="html.class.attr">
 
54
      <xsl:with-param name="node" select="$row"/>
 
55
      <xsl:with-param name="class">
 
56
        <xsl:if test="($row/../self::tbody and (count($row/preceding-sibling::row) mod 2 = 1)) or
 
57
                      ($row/../self::db:tbody and (count($row/preceding-sibling::db:row) mod 2 = 1))">
 
58
          <xsl:text>shade</xsl:text>
 
59
        </xsl:if>
 
60
      </xsl:with-param>
 
61
    </xsl:call-template>
59
62
    <xsl:if test="$row/*[1]">
60
63
      <xsl:call-template name="db2html.entry">
61
64
        <xsl:with-param name="entry" select="$row/*[1]"/>
424
427
        <xsl:call-template name="html.lang.attrs">
425
428
          <xsl:with-param name="parent" select=".."/>
426
429
        </xsl:call-template>
 
430
        <xsl:call-template name="html.class.attr">
 
431
          <xsl:with-param name="node" select="$entry"/>
 
432
          <xsl:with-param name="class" select="$class"/>
 
433
        </xsl:call-template>
427
434
        <xsl:if test="$style != ''">
428
435
          <xsl:attribute name="style">
429
436
            <xsl:value-of select="normalize-space($style)"/>
430
437
          </xsl:attribute>
431
438
        </xsl:if>
432
 
        <xsl:if test="$class != ''">
433
 
          <xsl:attribute name="class">
434
 
            <xsl:value-of select="normalize-space($class)"/>
435
 
          </xsl:attribute>
436
 
        </xsl:if>
437
439
        <xsl:if test="number($rowspan) &gt; 1">
438
440
          <xsl:attribute name="rowspan">
439
441
            <xsl:value-of select="$rowspan"/>
957
959
    </xsl:choose>
958
960
  </xsl:variable>
959
961
  <table>
 
962
    <xsl:call-template name="html.class.attr"/>
960
963
    <xsl:call-template name="html.lang.attrs"/>
961
964
    <xsl:apply-templates select="thead | db:thead">
962
965
      <xsl:with-param name="colspecs" select="colspec | db:colspec"/>
975
978
 
976
979
<!-- = table = -->
977
980
<xsl:template match="table | informaltable | db:table | db:informaltable">
978
 
  <div class="table">
 
981
  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
 
982
  <xsl:if test="$if != ''">
 
983
  <div>
 
984
    <xsl:call-template name="html.class.attr">
 
985
      <xsl:with-param name="class" select="'table'"/>
 
986
    </xsl:call-template>
979
987
    <xsl:call-template name="html.lang.attrs"/>
980
988
    <xsl:call-template name="db2html.anchor"/>
981
989
    <xsl:apply-templates select="title | db:title | db:info/db:title"/>
993
1001
      <xsl:when test="db:tgroup">
994
1002
        <xsl:apply-templates select="db:tgroup"/>
995
1003
      </xsl:when>
996
 
      <xsl:when test="tr">
997
 
        <xsl:apply-templates select="col | colgroup | tr"/>
998
 
        <xsl:apply-templates select="caption"/>
999
 
      </xsl:when>
1000
 
      <xsl:when test="db:tr">
1001
 
        <xsl:apply-templates select="db:col | db:colgroup | db:tr"/>
1002
 
        <xsl:apply-templates select="db:caption"/>
1003
 
      </xsl:when>
1004
1004
      <xsl:otherwise>
1005
 
        <xsl:apply-templates select="thead | db:thead"/>
1006
 
        <xsl:apply-templates select="tbody | db:tbody"/>
1007
 
        <xsl:apply-templates select="tfoot | db:tfoot"/>
 
1005
        <xsl:call-template name="db2html.table.table">
 
1006
          <xsl:with-param name="node" select="."/>
 
1007
          <xsl:with-param name="table" select="."/>
 
1008
        </xsl:call-template>
1008
1009
        <xsl:apply-templates select="caption | db:caption"/>
1009
1010
      </xsl:otherwise>
1010
1011
    </xsl:choose>
1011
1012
  </div>
 
1013
  </xsl:if>
1012
1014
</xsl:template>
1013
1015
 
1014
1016
<!-- = tgroup = -->
1015
1017
<xsl:template match="tgroup | db:tgroup">
 
1018
  <xsl:call-template name="db2html.table.table">
 
1019
    <xsl:with-param name="node" select="."/>
 
1020
    <xsl:with-param name="table" select=".."/>
 
1021
  </xsl:call-template>
 
1022
</xsl:template>
 
1023
 
 
1024
<xsl:template name="db2html.table.table">
 
1025
  <xsl:param name="node" select="."/>
 
1026
  <xsl:param name="table" select="$node"/>
1016
1027
  <xsl:variable name="colsep">
1017
1028
    <xsl:choose>
1018
 
      <xsl:when test="@colsep">
1019
 
        <xsl:value-of select="string(@colsep)"/>
 
1029
      <xsl:when test="$node/@colsep">
 
1030
        <xsl:value-of select="string($node/@colsep)"/>
1020
1031
      </xsl:when>
1021
 
      <xsl:when test="not(.//*[@colsep][1])"/>
 
1032
      <xsl:when test="not($node//*[@colsep][1])"/>
1022
1033
      <xsl:otherwise>
1023
1034
        <xsl:text>0</xsl:text>
1024
1035
      </xsl:otherwise>
1026
1037
  </xsl:variable>
1027
1038
  <xsl:variable name="rowsep">
1028
1039
    <xsl:choose>
1029
 
      <xsl:when test="@rowsep">
1030
 
        <xsl:value-of select="string(@rowsep)"/>
 
1040
      <xsl:when test="$node/@rowsep">
 
1041
        <xsl:value-of select="string($node/@rowsep)"/>
1031
1042
      </xsl:when>
1032
 
      <xsl:when test="not(//*[@rowsep][1])"/>
 
1043
      <xsl:when test="not($node//*[@rowsep][1])"/>
1033
1044
      <xsl:otherwise>
1034
1045
        <xsl:text>0</xsl:text>
1035
1046
      </xsl:otherwise>
1036
1047
    </xsl:choose>
1037
1048
  </xsl:variable>
1038
1049
  <xsl:variable name="style">
1039
 
    <xsl:if test="../@frame = 'all' or not(../@frame)">
 
1050
    <xsl:if test="$table/@frame = 'all' or $table/@frame = 'border' or not($table/@frame)">
1040
1051
      <xsl:text>border: solid 1px; </xsl:text>
1041
1052
    </xsl:if>
1042
 
    <xsl:if test="../@frame = 'none'">
 
1053
    <xsl:if test="$table/@frame = 'none'">
1043
1054
      <xsl:text>border: none; </xsl:text>
1044
1055
    </xsl:if>
1045
 
    <xsl:if test="../@frame = 'bottom' or ../@frame = 'topbot'">
 
1056
    <xsl:if test="$table/@frame = 'bottom' or $table/@frame = 'topbot'">
1046
1057
      <xsl:text>border-bottom: solid 1px; </xsl:text>
1047
1058
    </xsl:if>
1048
 
    <xsl:if test="../@frame = 'top' or ../@frame = 'topbot'">
 
1059
    <xsl:if test="$table/@frame = 'top' or $table/@frame = 'topbot'">
1049
1060
      <xsl:text>border-top: solid 1px; </xsl:text>
1050
1061
    </xsl:if>
1051
 
    <xsl:if test="../@frame = 'sides'">
 
1062
    <xsl:if test="$table/@frame = 'sides'">
1052
1063
      <xsl:text>border-left: solid 1px; border-right: solid 1px; </xsl:text>
1053
1064
    </xsl:if>
1054
1065
  </xsl:variable>
1055
1066
  <xsl:variable name="class">
1056
 
    <xsl:if test="../@pgwide = '1'">
 
1067
    <xsl:if test="$table/@pgwide = '1'">
1057
1068
      <xsl:text>table-pgwide</xsl:text>
1058
1069
    </xsl:if>
 
1070
    <xsl:if test="$table/@rules = 'groups'">
 
1071
      <xsl:text> table-rules-groups</xsl:text>
 
1072
    </xsl:if>
 
1073
    <xsl:if test="$table/@rules = 'rows'">
 
1074
      <xsl:text> table-rules-rows</xsl:text>
 
1075
    </xsl:if>
 
1076
    <xsl:if test="$table/@rules = 'cols'">
 
1077
      <xsl:text> table-rules-cols</xsl:text>
 
1078
    </xsl:if>
 
1079
    <xsl:if test="$table/@rules = 'all'">
 
1080
      <xsl:text> table-rules-rows table-rules-cols</xsl:text>
 
1081
    </xsl:if>
1059
1082
  </xsl:variable>
1060
1083
  <table>
1061
 
    <xsl:call-template name="html.lang.attrs"/>
1062
 
    <xsl:if test="../title or ../db:title or ../db:info/db:title">
 
1084
    <xsl:call-template name="html.class.attr">
 
1085
      <xsl:with-param name="node" select="$node"/>
 
1086
      <xsl:with-param name="class" select="$class"/>
 
1087
    </xsl:call-template>
 
1088
    <xsl:call-template name="html.lang.attrs">
 
1089
      <xsl:with-param name="node" select="$node"/>
 
1090
    </xsl:call-template>
 
1091
    <xsl:if test="$table/title or $table/db:title or $table/db:info/db:title">
1063
1092
      <xsl:attribute name="summary">
1064
 
        <xsl:value-of select="../title | ../db:title | ../db:info/db:title"/>
 
1093
        <xsl:value-of select="$table/title | $table/db:title | $table/db:info/db:title"/>
1065
1094
      </xsl:attribute>
1066
1095
    </xsl:if>
1067
1096
    <xsl:if test="$style != ''">
1069
1098
        <xsl:value-of select="normalize-space($style)"/>
1070
1099
      </xsl:attribute>
1071
1100
    </xsl:if>
1072
 
    <xsl:if test="$class != ''">
1073
 
      <xsl:attribute name="class">
1074
 
        <xsl:value-of select="normalize-space($class)"/>
1075
 
      </xsl:attribute>
1076
 
    </xsl:if>
1077
 
    <xsl:apply-templates select="thead | db:thead">
1078
 
      <xsl:with-param name="colspecs" select="colspec | db:colspec"/>
1079
 
      <xsl:with-param name="spanspecs" select="spanspec | db:spanspec"/>
1080
 
      <xsl:with-param name="colsep" select="$colsep"/>
1081
 
      <xsl:with-param name="rowsep" select="$rowsep"/>
1082
 
    </xsl:apply-templates>
1083
 
    <xsl:apply-templates select="tbody | db:tbody">
1084
 
      <xsl:with-param name="colspecs" select="colspec | db:colspec"/>
1085
 
      <xsl:with-param name="spanspecs" select="spanspec | db:spanspec"/>
1086
 
      <xsl:with-param name="colsep" select="$colsep"/>
1087
 
      <xsl:with-param name="rowsep" select="$rowsep"/>
1088
 
    </xsl:apply-templates>
1089
 
    <xsl:apply-templates select="tfoot | db:tfoot">
1090
 
      <xsl:with-param name="colspecs" select="colspec | db:colspec"/>
1091
 
      <xsl:with-param name="spanspecs" select="spanspec | db:spanspec"/>
1092
 
      <xsl:with-param name="colsep" select="$colsep"/>
1093
 
      <xsl:with-param name="rowsep" select="$rowsep"/>
1094
 
    </xsl:apply-templates>
 
1101
    <xsl:choose>
 
1102
      <xsl:when test="tr | db:tr">
 
1103
        <tbody>
 
1104
          <xsl:apply-templates select="$node/tr | $node/db:tr">
 
1105
            <xsl:with-param name="colsep" select="$colsep"/>
 
1106
            <xsl:with-param name="rowsep" select="$rowsep"/>
 
1107
          </xsl:apply-templates>
 
1108
        </tbody>
 
1109
      </xsl:when>
 
1110
      <xsl:otherwise>
 
1111
        <xsl:apply-templates select="$node/thead | $node/db:thead">
 
1112
          <xsl:with-param name="colspecs" select="$node/colspec | $node/db:colspec"/>
 
1113
          <xsl:with-param name="spanspecs" select="$node/spanspec | $node/db:spanspec"/>
 
1114
          <xsl:with-param name="colsep" select="$colsep"/>
 
1115
          <xsl:with-param name="rowsep" select="$rowsep"/>
 
1116
        </xsl:apply-templates>
 
1117
        <xsl:apply-templates select="$node/tbody | $node/db:tbody">
 
1118
          <xsl:with-param name="colspecs" select="$node/colspec | $node/db:colspec"/>
 
1119
          <xsl:with-param name="spanspecs" select="$node/spanspec | $node/db:spanspec"/>
 
1120
          <xsl:with-param name="colsep" select="$colsep"/>
 
1121
          <xsl:with-param name="rowsep" select="$rowsep"/>
 
1122
        </xsl:apply-templates>
 
1123
        <xsl:apply-templates select="$node/tfoot | $node/db:tfoot">
 
1124
          <xsl:with-param name="colspecs" select="$node/colspec | $node/db:colspec"/>
 
1125
          <xsl:with-param name="spanspecs" select="$node/spanspec | $node/db:spanspec"/>
 
1126
          <xsl:with-param name="colsep" select="$colsep"/>
 
1127
          <xsl:with-param name="rowsep" select="$rowsep"/>
 
1128
        </xsl:apply-templates>
 
1129
      </xsl:otherwise>
 
1130
    </xsl:choose>
1095
1131
  </table>
1096
1132
</xsl:template>
1097
1133
 
1103
1139
  <xsl:param name="rowsep" select="''"/>
1104
1140
  <xsl:element name="{local-name(.)}" namespace="{$html.namespace}">
1105
1141
    <xsl:call-template name="html.lang.attrs"/>
 
1142
    <xsl:call-template name="html.class.attr"/>
1106
1143
    <xsl:if test="@valign">
1107
1144
      <xsl:attribute name="valign">
1108
1145
        <xsl:value-of select="@valign"/>
1137
1174
  </xsl:element>
1138
1175
</xsl:template>
1139
1176
 
 
1177
<!-- = tr = -->
 
1178
<xsl:template match="tr | db:tr">
 
1179
  <tr>
 
1180
    <xsl:call-template name="html.lang.attrs"/>
 
1181
    <xsl:call-template name="html.class.attr"/>
 
1182
    <xsl:choose>
 
1183
      <xsl:when test="@align = 'left' or @align = 'center' or 
 
1184
                      @align = 'right' or @align = 'justify' ">
 
1185
        <xsl:attribute name="style">
 
1186
          <xsl:text>text-align: </xsl:text>
 
1187
          <xsl:value-of select="@align"/>
 
1188
        </xsl:attribute>
 
1189
      </xsl:when>
 
1190
      <xsl:when test="@align = 'char'">
 
1191
        <xsl:attribute name="style">
 
1192
          <xsl:text>text-align: "</xsl:text>
 
1193
          <xsl:choose>
 
1194
            <xsl:when test="@char != ''">
 
1195
              <xsl:value-of select="@char"/>
 
1196
            </xsl:when>
 
1197
            <xsl:otherwise>
 
1198
              <xsl:text>.</xsl:text>
 
1199
            </xsl:otherwise>
 
1200
          </xsl:choose>
 
1201
          <xsl:text>"</xsl:text>
 
1202
        </xsl:attribute>
 
1203
      </xsl:when>
 
1204
    </xsl:choose>
 
1205
    <xsl:apply-templates/>
 
1206
  </tr>
 
1207
</xsl:template>
 
1208
 
 
1209
<!-- = td | th = -->
 
1210
<xsl:template match="td | th | db:td | db:th">
 
1211
  <xsl:element name="{local-name(.)}" namespace="{$html.namespace}">
 
1212
    <xsl:call-template name="html.lang.attrs"/>
 
1213
    <xsl:call-template name="html.class.attr"/>
 
1214
    <xsl:copy-of select="@valign | @rowspan | @colspan"/>
 
1215
    <xsl:choose>
 
1216
      <xsl:when test="@align = 'left' or @align = 'center' or 
 
1217
                      @align = 'right' or @align = 'justify' ">
 
1218
        <xsl:attribute name="style">
 
1219
          <xsl:text>text-align: </xsl:text>
 
1220
          <xsl:value-of select="@align"/>
 
1221
        </xsl:attribute>
 
1222
      </xsl:when>
 
1223
      <xsl:when test="@align = 'char'">
 
1224
        <xsl:attribute name="style">
 
1225
          <xsl:text>text-align: "</xsl:text>
 
1226
          <xsl:choose>
 
1227
            <xsl:when test="@char != ''">
 
1228
              <xsl:value-of select="@char"/>
 
1229
            </xsl:when>
 
1230
            <xsl:otherwise>
 
1231
              <xsl:text>.</xsl:text>
 
1232
            </xsl:otherwise>
 
1233
          </xsl:choose>
 
1234
          <xsl:text>"</xsl:text>
 
1235
        </xsl:attribute>
 
1236
      </xsl:when>
 
1237
    </xsl:choose>
 
1238
    <xsl:apply-templates/>
 
1239
  </xsl:element>
 
1240
</xsl:template>
 
1241
 
 
1242
 
1140
1243
</xsl:stylesheet>