Sample XSL Document
The default style sheet template installed with the application is called SRRSchedule.XSL.
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml"> <xsl:output method="html" indent="yes" version="4.01" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" doctype-public="//W3C//DTD XHTML 1.0 Transitional//EN"/> <xsl:template match="/"> <html xmlns="http://www.w3.org/1999/xhtml"> <xsl:attribute name="lang"> <xsl:value-of select="/SRRScheduleData/@LanguageCode"/> </xsl:attribute> <xsl:attribute name="dir"> <xsl:value-of select="/SRRScheduleData/@Direction"/> </xsl:attribute> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <link rel="stylesheet" type="text/css" href="SRRSchedule.css"/> <title> <xsl:value-of select="SRRScheduleData/Schedule[1]/ReportTitle"/> </title> </head> <body> <div> <xsl:for-each select="SRRScheduleData/Schedule"> <div> <xsl:if test="position() != 1"> <br style="page-break-before: always;"/> </xsl:if> <xsl:apply-templates select="ReportTitle"/> <table> <xsl:if test="/SRRScheduleData/@TableWidthPercent='true'"> <colgroup> <xsl:apply-templates select="/SRRScheduleData/Columns/Heading" mode="ColumnWidths"/> </colgroup> </xsl:if> <xsl:apply-templates select="MonthAssignments"/> <xsl:apply-templates select="Note"/> </table> </div> </xsl:for-each> </div> </body> </html> </xsl:template> <xsl:template match="ReportTitle"> <p class="textReportTitle"> <xsl:value-of select="." disable-output-escaping="yes" /> </p> </xsl:template> <xsl:template match="MonthAssignments"> <xsl:if test="@IncludeGap='true'"> <xsl:call-template name="GapRow"/> </xsl:if> <xsl:if test="@IncludeHeadings='true'"> <tr> <xsl:apply-templates select="/SRRScheduleData/Columns/Heading"/> </tr> </xsl:if> <xsl:apply-templates select="AssignmentRow"/> </xsl:template> <xsl:template match="Heading"> <td class="cellHeading"> <xsl:attribute name="style"> <xsl:text>text-align: </xsl:text> <xsl:value-of select="@TextAlign"/> <xsl:text>;</xsl:text> </xsl:attribute> <xsl:value-of select="."/> </td> </xsl:template> <xsl:template match="Heading" mode="ColumnWidths"> <col width="@ColumnWidth"/> </xsl:template> <xsl:template match="AssignmentRow"> <tr> <xsl:attribute name="class"> <xsl:choose> <xsl:when test="@RowType='Even'">rowEven</xsl:when> <xsl:when test="@RowType='Odd'">rowOdd</xsl:when> </xsl:choose> </xsl:attribute> <xsl:apply-templates select="Date"/> <xsl:apply-templates select="Name"/> <xsl:apply-templates select="SpecialEvent"/> </tr> </xsl:template> <xsl:template match="Date"> <td class="cellDate"> <xsl:attribute name="style"> <xsl:text>text-transform: </xsl:text> <xsl:value-of select="/SRRScheduleData/@DateTextCase"/> </xsl:attribute> <xsl:value-of select="."/> </td> </xsl:template> <xsl:template match="Name"> <xsl:choose> <xsl:when test=".=''"> <td class="cellEmpty"> <xsl:text> </xsl:text> </td> </xsl:when> <xsl:otherwise> <td class="cellName"> <xsl:choose> <xsl:when test="@Highlight='true'"> <xsl:attribute name="class">cellHighlight</xsl:attribute> </xsl:when> <xsl:when test="@Conflict='true'"> <xsl:attribute name="class">cellConflict</xsl:attribute> </xsl:when> </xsl:choose> <xsl:value-of select="."/> </td> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="Note"> <tr> <td class="cellNote"> <xsl:attribute name="colspan"> <xsl:value-of select="count(/SRRScheduleData/Columns/Heading)"/> </xsl:attribute> <!-- Why does this not apply the HTML syntax? --> <xsl:value-of select="." disable-output-escaping="yes"/> </td> </tr> </xsl:template> <xsl:template match="SpecialEvent"> <td class="cellSpecialEvent"> <xsl:attribute name="colspan"> <xsl:value-of select="count(/SRRScheduleData/Columns/Heading)-1"/> </xsl:attribute> <xsl:value-of select="Description"/> </td> </xsl:template> <xsl:template name="GapRow"> <!-- Why is this row not showing as 5mm high? --> <tr> <td class="cellGap"> <xsl:attribute name="colspan"> <xsl:value-of select="count(/SRRScheduleData/Columns/Heading)"/> </xsl:attribute> <xsl:text> </xsl:text> </td> </tr> </xsl:template> </xsl:stylesheet>
|