<?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <!-- | UtilData.xsl: Transform <data> structural info into HTML table | Elements in ROWSET/ROW whose name begins with the | prefix 'H_' will be hidden from display in the output. +--> <xsl:template match="ROWSET"> <center> <table border="0" cellpadding="4"> <tr> <!-- If there are no ROW in the ROWSET, print a message --> <xsl:if test="not(ROW)"><td>No Matches</td></xsl:if> <!-- | Process child elements of first ROW whose names do NOT start | with 'H_'. This let's user hide column by aliasing it to H_NAME +--> <xsl:apply-templates select="ROW[1]/*[not(starts-with(name(.),'H_'))]" mode="columnHeaders"/> </tr> <xsl:apply-templates/> </table> </center> </xsl:template> <!-- | Match ROW and create a html <tr> table row. Alternate colors by using | attribute value template to toggle between CSS class name r0 and r1. +--> <xsl:template match="ROW"> <tr class="r{position() mod 2}"> <!-- Select all children of ROW whose names do not start with 'H_' --> <xsl:apply-templates select="*[not(starts-with(name(.),'H_'))]"/> </tr> </xsl:template> <!-- Match ROW child element --> <xsl:template match="ROW/*"> <td valign="top"><xsl:apply-templates/></td> </xsl:template> <!-- Match ROW child element and generate column heading --> <xsl:template match="ROW/*" mode="columnHeaders"> <th align="left"> <!-- Beautify Element Names "This_That" or "This-That" to "This That" --> <xsl:value-of select="translate(name(.),'_-','  ')"/> </th> </xsl:template> </xsl:stylesheet> |