Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ms="urn:schemas-microsoft-com:xslt" xmlns:dt="urn:schemas-microsoft-com:datatypes">
- <xsl:key name="Projects" match="Row" use="ProjectNo" />
- <xsl:key name="Project-Phases" match="Row" use="concat(ProjectNo, '|', Phase)" />
- <xsl:key name="Project-Phase-Category" match="Row" use="concat(ProjectNo, '|', Phase, '|', Category)" />
- <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
- <xsl:template match="/">
- <div class="pso_projects">
- <link type="text/css" rel="stylesheet" href="organization/Documents/style.css" />
- <link href="organization/Documents/jqtreetable/stylesheets/jquery.treeTable.css" rel="stylesheet" type="text/css" />
- <script type="text/javascript" src="organization/Documents/jquery-1.7.js"></script>
- <script type="text/javascript" src="organization/Documents/jqtreetable/javascripts/jquery.treeTable.min.js"></script>
- <xsl:apply-templates select="//Row[generate-id() = generate-id(key('Projects', ProjectNo)[1])]" mode="project"/>
- </div>
- </xsl:template>
- <!-- Main header and body for the project -->
- <xsl:template match="Row" mode="project">
- <div class="pso_container">
- <xsl:attribute name="ID">
- <xsl:value-of select="ProjectNo"/>"
- </xsl:attribute>
- <div class="item">
- <table class="deliverables" cellpadding="2">
- <tr>
- <td rowspan="3" style="width: 400px;">
- <h2 class="normal">
- <xsl:value-of select="Customer"/>
- </h2>
- <p class="normal">
- <xsl:value-of select="concat(ProjectName, ' (', ProjectNo,') - ', Methodology)"/>
- <br />
- </p>
- </td>
- <td colspan="4" style="height: 6px"></td>
- <td rowspan="3"> </td>
- </tr>
- <tr>
- <td>
- <xsl:attribute name="id">
- <xsl:value-of select="concat(ProjectNo, '-Scores-Target')"/>
- </xsl:attribute>
- </td>
- </tr>
- <tr>
- <td colspan="4">
- <p class="normal">
- <xsl:choose>
- <xsl:when test="ProjectNotes = ''"> </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="ProjectNotes"/>
- </xsl:otherwise>
- </xsl:choose>
- </p>
- </td>
- </tr>
- </table>
- </div>
- <!-- Now iterate through each phase -->
- <xsl:apply-templates select="//Row[generate-id() = generate-id(key('Project-Phases', concat(ProjectNo, '|', Phase))[1][ProjectNo=current()/ProjectNo])]" mode="phase"/>
- </div>
- </xsl:template>
- <!-- The body and headers for each phase -->
- <xsl:template match="Row" mode="phase">
- <xsl:variable name="phaseID">
- <xsl:value-of select="generate-id(key('Project-Phases', concat(ProjectNo, '|', Phase)))"/>
- </xsl:variable>
- <div class="item">
- <table class="deliverables" id="{$phaseID}">
- <script type="text/javascript">
- $(document).ready(function() {
- $("#<xsl:value-of select="$phaseID"/>").treeTable({
- clickableNodeNames: true,
- indent: 19
- });
- });
- </script>
- <tbody id="projectmain">
- <tr class="tablehead">
- <td colspan="4" class="tablehead">
- <p class="normal">
- <xsl:value-of select="Phase"/>
- </p>
- </td>
- </tr>
- <!-- Now iterate through each category -->
- <xsl:apply-templates select="key('Project-Phases', concat(ProjectNo, '|', Phase))[ProjectNo=current()/ProjectNo]" mode="category"/>
- <!--<xsl:apply-templates select="key('Project-Phase-Category', concat(ProjectNo, '|', Phase, '|', Category))[ProjectNo=current()/ProjectNo]" mode="category"/>-->
- </tbody>
- </table>
- </div>
- </xsl:template>
- <!-- Display a category header if one exists -->
- <xsl:template match="Row" mode="category">
- <xsl:if test="Category != ''">
- <tr>
- <td colspan="4" class="siteName" style="height: 24px; padding-left:19px;">
- <span class="normal">
- <xsl:value-of select="Category"/>
- </span>
- </td>
- </tr>
- </xsl:if>
- <!-- Either way, now call every deliverable -->
- <xsl:apply-templates select="key('Project-Phases', concat(ProjectNo, '|', Phase))[MasterID = DeliverableID][ProjectNo=current()/ProjectNo]"/>
- <!--<xsl:apply-templates select="//Row[Phase=current()/Phase][MasterID=DeliverableID][MasterID != DeliverableID][ProjectNo=current()/ProjectNo]"/>-->
- </xsl:template>
- <!-- Main guts -->
- <xsl:template match="Row">
- <!-- Is this row a parent? -->
- <xsl:variable name="Parent">
- <xsl:choose>
- <xsl:when test="//Row[Phase=current()/Phase][MasterID=current()/DeliverableID][MasterID != DeliverableID][ProjectNo=current()/ProjectNo]">
- 1
- </xsl:when>
- <xsl:otherwise>
- 0
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <!-- Is it a child? -->
- <xsl:variable name="Child">
- <xsl:choose>
- <xsl:when test="DeliverableID != MasterID">
- 1
- </xsl:when>
- <xsl:otherwise>
- 0
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <tr>
- <xsl:attribute name="id">
- <xsl:value-of select="concat('node-', DeliverableID)"/>
- </xsl:attribute>
- <xsl:if test="$Child = 1">
- <xsl:attribute name="class">
- <xsl:value-of select="concat('child-of-node-', MasterID)"/>
- </xsl:attribute>
- </xsl:if>
- <td class="doWhite" style="height: 24px; padding-left:19px;">
- <span class="normal">
- <xsl:value-of select="ItemDescription"/>
- </span>
- </td>
- <td class="doWhite" style="width: 125px; height: 24px">
- <p class="normal">
- <xsl:value-of select="Owner"/>
- </p>
- </td>
- <td style="width: 65px; height: 24px">
- <xsl:call-template name="status"/>
- </td>
- <td class="doWhite" style="width: 490px;">
- <p class="normal">
- <xsl:value-of select="ItemNotes"/>
- </p>
- </td>
- </tr>
- <!-- Call children -->
- <xsl:if test="$Parent = 1">
- <xsl:apply-templates select="//Row[Phase=current()/Phase][MasterID=current()/DeliverableID][MasterID != DeliverableID][ProjectNo=current()/ProjectNo]"/>
- </xsl:if>
- </xsl:template>
- <xsl:template name="status">
- <xsl:variable name="HealthColor">
- <xsl:choose>
- <xsl:when test="Health != ''">
- <xsl:value-of select="concat('do',Health)"/>
- </xsl:when>
- <xsl:otherwise>
- doWhite
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <!-- TODO: Alter parent tag so the <p> tag doesn't have to be repeated -->
- <xsl:choose>
- <xsl:when test="Status='Not Applicable'">
- <xsl:attribute name="class">
- doGray
- </xsl:attribute>
- <p class="centerit">
- N/A
- </p>
- </xsl:when>
- <xsl:when test="Status='Complete'">
- <xsl:attribute name="class">
- <xsl:value-of select="$HealthColor"/>
- </xsl:attribute>
- <p class="centerit">
- <span class="check">✓</span>
- </p>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute name="class">
- <xsl:value-of select="$HealthColor"/>
- </xsl:attribute>
- <p class="centerit">
- <xsl:value-of select="concat(CompletionPercentage,'%')"/>
- </p>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- </xsl:stylesheet>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement