Created
January 24, 2012 15:18
-
-
Save edalquist/1670654 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" ?> | |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsql="urn:oracle-xsql" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:fox="http://xml.apache.org/fop/extensions" version="1.0"> | |
<xsl:output method="xml" indent="no"/> | |
<xsl:template match="/"> | |
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> | |
<!-- defines the layout master --> | |
<fo:layout-master-set> | |
<!-- defines the layout of a page --> | |
<fo:simple-page-master master-name="simple" | |
page-height="11in" | |
page-width="8.5in" | |
margin-top="0.25in" | |
margin-bottom="0.25in" | |
margin-left="0.25in" | |
margin-right="0.25in"> | |
<!-- defines the layout of the body --> | |
<fo:region-body margin-top="0.3in" margin-bottom="0.3in"/> | |
</fo:simple-page-master> | |
</fo:layout-master-set> | |
<xsl:for-each select="university/dept"> | |
<fox:outline> | |
<xsl:attribute name="internal-destination"> | |
<xsl:value-of select="@code"/> | |
</xsl:attribute> | |
<fox:label><xsl:value-of select="@code"/></fox:label> | |
<xsl:for-each select="course"> | |
<xsl:attribute name="internal-destination"> | |
<xsl:value-of select="@crse_numb"/> | |
</xsl:attribute> | |
<fox:label><xsl:value-of select="@crse_numb"/></fox:label> | |
</xsl:for-each> | |
</fox:outline> | |
</xsl:for-each> | |
<!-- add footer and header info here --> | |
<fo:page-sequence master-name="simple" initial-page-number="1"> | |
<!-- Here is where we define the content/behavior of the body --> | |
<fo:flow flow-name="xsl-region-body"> | |
<fo:block font-size="9pt" font-family="Times Roman"> | |
<xsl:apply-templates/> | |
</fo:block> | |
</fo:flow> | |
</fo:page-sequence> | |
</fo:root> | |
</xsl:template> | |
<xsl:template match="university/dept"> | |
<fo:block> | |
<xsl:attribute name="id"> | |
<xsl:value-of select="@code"/> | |
</xsl:attribute> | |
<xsl:apply-templates/> | |
</fo:block> | |
</xsl:template> | |
<xsl:template match="course"> | |
<fo:block text-align="center"> | |
<xsl:attribute name="id"> | |
<xsl:value-of select="@crse_numb"/> | |
</xsl:attribute> | |
<xsl:if test="position() != last()"> | |
<xsl:attribute name="break-after">page</xsl:attribute> | |
</xsl:if> | |
<fo:table> | |
<fo:table-column column-width="1.75in"/> | |
<fo:table-column column-width="4.5in"/> | |
<fo:table-column column-width="1.75in"/> | |
<fo:table-body> | |
<fo:table-row> | |
<fo:table-cell text-align="start"> | |
<fo:block font-size="11pt" font-weight="bold"> | |
</fo:block> | |
</fo:table-cell> | |
<fo:table-cell text-align="center"> | |
<fo:block font-size="13pt" font-weight="bold"> | |
</fo:block> | |
</fo:table-cell> | |
<fo:table-cell text-align="end"> | |
<fo:block font-size="11pt" font-weight="bold"> | |
Class Roster | |
</fo:block> | |
</fo:table-cell> | |
</fo:table-row> | |
<fo:table-row> | |
<fo:table-cell text-align="start"> | |
<fo:block> | |
</fo:block> | |
</fo:table-cell> | |
<fo:table-cell text-align="center"> | |
<fo:block> | |
</fo:block> | |
</fo:table-cell> | |
<fo:table-cell text-align="end"> | |
<fo:block> | |
</fo:block> | |
</fo:table-cell> | |
</fo:table-row> | |
</fo:table-body> | |
</fo:table> | |
<fo:table> | |
<fo:table-column column-width="1.25in"/> | |
<fo:table-column column-width="1.25in"/> | |
<fo:table-column column-width="1.25in"/> | |
<fo:table-column column-width="1.25in"/> | |
<fo:table-column column-width="1.25in"/> | |
<fo:table-column column-width="1.25in"/> | |
<fo:table-body> | |
<xsl:for-each select="student[((position() - 1) mod 6)=0]"> | |
<xsl:call-template name="roster_row"> | |
<xsl:with-param name="row_index" select="position()"/> | |
</xsl:call-template> | |
</xsl:for-each> | |
</fo:table-body> | |
</fo:table> | |
</fo:block> | |
</xsl:template> | |
<xsl:template name="roster_row"> | |
<xsl:param name="row_index"/> | |
<fo:table-row> | |
<xsl:call-template name="roster_cell"> | |
<xsl:with-param name="row_index" select="$row_index - 1"/> | |
<xsl:with-param name="cell_index" select="1"/> | |
</xsl:call-template> | |
</fo:table-row> | |
</xsl:template> | |
<xsl:template name="roster_cell"> | |
<xsl:param name="row_index"/> | |
<xsl:param name="cell_index"/> | |
<xsl:if test="$cell_index <= 6"> | |
<fo:table-cell text-align="center"> | |
<xsl:if test="(($row_index*6) + $cell_index) <= count(../student)"> | |
<fo:external-graphic height="1.5in" width="1.13in"> | |
<xsl:attribute name="src"> | |
<xsl:text>http://speedy.acs.it.mtu.edu:7777/xsql/Photo_Rosters/images/</xsl:text><xsl:value-of select="../student[($row_index*6) + $cell_index]/image"/> | |
</xsl:attribute> | |
</fo:external-graphic> | |
<fo:block><xsl:value-of select="../student[($row_index*6) + $cell_index]/first-name"/></fo:block> | |
<fo:block><xsl:value-of select="../student[($row_index*6) + $cell_index]/last-name"/></fo:block> | |
</xsl:if> | |
</fo:table-cell> | |
<xsl:call-template name="roster_cell"> | |
<xsl:with-param name="row_index" select="$row_index"/> | |
<xsl:with-param name="cell_index" select="$cell_index + 1"/> | |
</xsl:call-template> | |
</xsl:if> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment