Commit e0a5bb7b authored by Andre Malo's avatar Andre Malo
Browse files

introduce data tables


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@106722 13f79535-47bb-0310-9956-ffa450edef68
parent 649db9af
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -358,6 +358,16 @@ td.centered {
    text-align: center;
}

td.data {
    font-family: monospace;
    text-align: right;
    padding-left: 1em;
}

th.data {
    text-align: right;
}

tr.odd { /* for large tables alternating colors */
    background-color: #f2f2f2;
}
+65 −26
Original line number Diff line number Diff line
@@ -96,13 +96,16 @@
        <xsl:comment>
            &lf;
            <xsl:text>        </xsl:text>
            <xsl:text>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</xsl:text>
            <xsl:text>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</xsl:text>
            <xsl:text>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</xsl:text>
            &lf;
            <xsl:text>              </xsl:text>
            <xsl:text>This file is generated from xml source: DO NOT EDIT</xsl:text>
            <xsl:text>This file is generated from xml source: </xsl:text>
            <xsl:text>DO NOT EDIT</xsl:text>
            &lf;
            <xsl:text>        </xsl:text>
            <xsl:text>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</xsl:text>
            <xsl:text>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</xsl:text>
            <xsl:text>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</xsl:text>
            &lf;
            <xsl:text>      </xsl:text>
        </xsl:comment>
@@ -747,6 +750,7 @@
</xsl:template>
<!-- /related/directivelist -->


<!-- ==================================================================== -->
<!-- <table>                                                              -->
<!-- ==================================================================== -->
@@ -757,39 +761,74 @@
        <xsl:attribute name="class">bordered</xsl:attribute>
    </xsl:if>

    <xsl:choose>
    <xsl:when test="@style = 'zebra'">
        <xsl:apply-templates select="tr" mode="zebra-table" />
    </xsl:when>
    <xsl:when test="@style = 'data'">
        <xsl:apply-templates select="tr" mode="data-table" />
    </xsl:when>
    <xsl:otherwise>
        <xsl:apply-templates />
    </xsl:otherwise>
    </xsl:choose>
</table>
</xsl:template>
<!-- /table -->

<!-- data-table -->
<xsl:template match="tr" mode="data-table">
<!-- style="data": fixed font, padding-left and right alignment for <td>s -->
<xsl:variable name="cross-table" select="boolean(
    preceding-sibling::tr/th[1]|following-sibling::tr/th[1])" />

<tr>
    <xsl:for-each select="node()">
        <xsl:choose>
        <xsl:when test="local-name() = 'td'">
            <td class="data">
                <xsl:apply-templates select="*|@*|text()" />
            </td>
        </xsl:when>
        <xsl:when test="local-name() = 'th' and
                        (not($cross-table) or
                         count(preceding-sibling::*) &gt; 0)">
            <th class="data">
                <xsl:apply-templates select="*|@*|text()" />
            </th>
        </xsl:when>
        <xsl:otherwise>
            <xsl:apply-templates select="self::node()" />
        </xsl:otherwise>
        </xsl:choose>
    </xsl:for-each>
</tr>&lf;
</xsl:template>


<!-- zebra-table -->
<xsl:template match="tr" mode="zebra-table">
<!-- style="zebra": alternating colors per row, i.e. every second row -->
<!--                gets a class="odd". Header lines (no <td>) get a  -->
<!--                class="header". These lines will be excluded from -->
<!--                the "odd" line count. That way header lines act   -->
<!--                interjectional, which creates a better visual and -->
<!--                psychological effect.                             -->
    <xsl:choose>
    <xsl:when test="@style = 'zebra'">
        <xsl:for-each select="tr">
<tr>
    <xsl:choose>
    <xsl:when test="count(td) = 0">
        <xsl:attribute name="class">header</xsl:attribute>
    </xsl:when>

                <xsl:when
                    test="position() mod 2 =
                            (count(preceding-sibling::tr[count(td) = 0]) mod 2)">
    <xsl:when test="position() mod 2 = (count(preceding-sibling::tr[count(td) = 0]) mod 2)">
        <xsl:attribute name="class">odd</xsl:attribute>
    </xsl:when>
    </xsl:choose>

    <xsl:apply-templates />
</tr>&lf;
        </xsl:for-each>
    </xsl:when>
    <xsl:otherwise>
        <xsl:apply-templates />
    </xsl:otherwise>
    </xsl:choose>
</table>
</xsl:template>
<!-- /table -->
<!-- /zebra-table -->


<!-- ==================================================================== -->