Advertisement
Guest User

Untitled

a guest
Feb 9th, 2012
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 7.79 KB | None | 0 0
  1. <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">
  2.   <xsl:key name="Projects" match="Row" use="ProjectNo" />
  3.   <xsl:key name="Project-Phases" match="Row" use="concat(ProjectNo, '|', Phase)" />
  4.   <xsl:key name="Project-Phase-Category" match="Row" use="concat(ProjectNo, '|', Phase, '|', Category)" />
  5.  
  6.   <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
  7.  
  8.   <xsl:template match="/">
  9.     <div class="pso_projects">
  10.       <link type="text/css" rel="stylesheet" href="organization/Documents/style.css" />
  11.       <link href="organization/Documents/jqtreetable/stylesheets/jquery.treeTable.css" rel="stylesheet" type="text/css" />
  12.  
  13.       <script type="text/javascript" src="organization/Documents/jquery-1.7.js"></script>
  14.       <script type="text/javascript" src="organization/Documents/jqtreetable/javascripts/jquery.treeTable.min.js"></script>
  15.  
  16.       <xsl:apply-templates select="//Row[generate-id() = generate-id(key('Projects', ProjectNo)[1])]" mode="project"/>
  17.     </div>
  18.   </xsl:template>
  19.  
  20.   <!-- Main header and body for the project -->
  21.   <xsl:template match="Row" mode="project">
  22.     <div class="pso_container">
  23.       <xsl:attribute name="ID">
  24.         <xsl:value-of select="ProjectNo"/>"
  25.       </xsl:attribute>
  26.       <div class="item">
  27.         <table class="deliverables" cellpadding="2">
  28.           <tr>
  29.             <td rowspan="3" style="width: 400px;">
  30.               <h2 class="normal">
  31.                 <xsl:value-of select="Customer"/>
  32.               </h2>
  33.               <p class="normal">
  34.                 <xsl:value-of select="concat(ProjectName, ' (', ProjectNo,') - ', Methodology)"/>
  35.                 <br />
  36.               </p>
  37.             </td>
  38.             <td colspan="4" style="height: 6px"></td>
  39.             <td rowspan="3">&#160;</td>
  40.           </tr>
  41.           <tr>
  42.             <td>
  43.               <xsl:attribute name="id">
  44.                 <xsl:value-of select="concat(ProjectNo, '-Scores-Target')"/>
  45.               </xsl:attribute>
  46.             </td>
  47.           </tr>
  48.           <tr>
  49.             <td colspan="4">
  50.               <p class="normal">
  51.                 <xsl:choose>
  52.                   <xsl:when test="ProjectNotes = ''">&#160;</xsl:when>
  53.                   <xsl:otherwise>
  54.                     <xsl:value-of select="ProjectNotes"/>
  55.                   </xsl:otherwise>
  56.                 </xsl:choose>
  57.               </p>
  58.             </td>
  59.           </tr>
  60.         </table>
  61.       </div>
  62.       <!-- Now iterate through each phase -->
  63.       <xsl:apply-templates select="//Row[generate-id() = generate-id(key('Project-Phases', concat(ProjectNo, '|', Phase))[1][ProjectNo=current()/ProjectNo])]" mode="phase"/>
  64.     </div>
  65.   </xsl:template>
  66.  
  67.   <!-- The body and headers for each phase -->
  68.   <xsl:template match="Row" mode="phase">
  69.     <xsl:variable name="phaseID">
  70.       <xsl:value-of select="generate-id(key('Project-Phases', concat(ProjectNo, '|', Phase)))"/>
  71.     </xsl:variable>
  72.    
  73.     <div class="item">
  74.       <table class="deliverables" id="{$phaseID}">
  75.         <script type="text/javascript">
  76.           $(document).ready(function()  {
  77.           $("#<xsl:value-of select="$phaseID"/>").treeTable({
  78.           clickableNodeNames: true,
  79.           indent: 19
  80.           });
  81.           });
  82.         </script>
  83.         <tbody id="projectmain">
  84.           <tr class="tablehead">
  85.             <td colspan="4" class="tablehead">
  86.               <p class="normal">
  87.                 <xsl:value-of select="Phase"/>
  88.               </p>
  89.             </td>
  90.           </tr>
  91.           <!-- Now iterate through each category -->
  92.           <xsl:apply-templates select="key('Project-Phases', concat(ProjectNo, '|', Phase))[ProjectNo=current()/ProjectNo]" mode="category"/>
  93.           <!--<xsl:apply-templates select="key('Project-Phase-Category', concat(ProjectNo, '|', Phase, '|', Category))[ProjectNo=current()/ProjectNo]" mode="category"/>-->
  94.         </tbody>
  95.       </table>
  96.     </div>
  97.   </xsl:template>
  98.  
  99.   <!-- Display a category header if one exists -->
  100.   <xsl:template match="Row" mode="category">
  101.     <xsl:if test="Category != ''">
  102.       <tr>
  103.         <td colspan="4" class="siteName" style="height: 24px; padding-left:19px;">
  104.           <span class="normal">
  105.             <xsl:value-of select="Category"/>
  106.           </span>
  107.         </td>
  108.       </tr>
  109.     </xsl:if>
  110.     <!-- Either way, now call every deliverable -->
  111.     <xsl:apply-templates select="key('Project-Phases', concat(ProjectNo, '|', Phase))[MasterID = DeliverableID][ProjectNo=current()/ProjectNo]"/>
  112.     <!--<xsl:apply-templates select="//Row[Phase=current()/Phase][MasterID=DeliverableID][MasterID != DeliverableID][ProjectNo=current()/ProjectNo]"/>-->
  113.   </xsl:template>
  114.  
  115.   <!-- Main guts -->
  116.   <xsl:template match="Row">
  117.     <!-- Is this row a parent? -->
  118.     <xsl:variable name="Parent">
  119.       <xsl:choose>
  120.         <xsl:when test="//Row[Phase=current()/Phase][MasterID=current()/DeliverableID][MasterID != DeliverableID][ProjectNo=current()/ProjectNo]">
  121.           1
  122.         </xsl:when>
  123.         <xsl:otherwise>
  124.           0
  125.         </xsl:otherwise>
  126.       </xsl:choose>
  127.     </xsl:variable>
  128.  
  129.     <!-- Is it a child? -->
  130.     <xsl:variable name="Child">
  131.       <xsl:choose>
  132.         <xsl:when test="DeliverableID != MasterID">
  133.           1
  134.         </xsl:when>
  135.         <xsl:otherwise>
  136.           0
  137.         </xsl:otherwise>
  138.       </xsl:choose>
  139.     </xsl:variable>
  140.     <tr>
  141.       <xsl:attribute name="id">
  142.         <xsl:value-of select="concat('node-', DeliverableID)"/>
  143.       </xsl:attribute>
  144.       <xsl:if test="$Child = 1">
  145.         <xsl:attribute name="class">
  146.           <xsl:value-of select="concat('child-of-node-', MasterID)"/>
  147.         </xsl:attribute>
  148.       </xsl:if>
  149.       <td class="doWhite" style="height: 24px; padding-left:19px;">
  150.         <span class="normal">
  151.           <xsl:value-of select="ItemDescription"/>
  152.         </span>
  153.       </td>
  154.       <td class="doWhite" style="width: 125px; height: 24px">
  155.         <p class="normal">
  156.           <xsl:value-of select="Owner"/>
  157.         </p>
  158.       </td>
  159.       <td style="width: 65px; height: 24px">
  160.         <xsl:call-template name="status"/>
  161.       </td>
  162.       <td class="doWhite" style="width: 490px;">
  163.         <p class="normal">
  164.           <xsl:value-of select="ItemNotes"/>
  165.         </p>
  166.       </td>
  167.     </tr>
  168.  
  169.     <!-- Call children -->
  170.     <xsl:if test="$Parent = 1">
  171.       <xsl:apply-templates select="//Row[Phase=current()/Phase][MasterID=current()/DeliverableID][MasterID != DeliverableID][ProjectNo=current()/ProjectNo]"/>
  172.     </xsl:if>
  173.   </xsl:template>
  174.  
  175.   <xsl:template name="status">
  176.     <xsl:variable name="HealthColor">
  177.       <xsl:choose>
  178.         <xsl:when test="Health != ''">
  179.           <xsl:value-of select="concat('do',Health)"/>
  180.         </xsl:when>
  181.         <xsl:otherwise>
  182.           doWhite
  183.         </xsl:otherwise>
  184.       </xsl:choose>
  185.     </xsl:variable>
  186.     <!-- TODO: Alter parent tag so the <p> tag doesn't have to be repeated -->
  187.     <xsl:choose>
  188.       <xsl:when test="Status='Not Applicable'">
  189.         <xsl:attribute name="class">
  190.           doGray
  191.         </xsl:attribute>
  192.         <p class="centerit">
  193.           N/A
  194.         </p>
  195.       </xsl:when>
  196.       <xsl:when test="Status='Complete'">
  197.         <xsl:attribute name="class">
  198.           <xsl:value-of select="$HealthColor"/>
  199.         </xsl:attribute>
  200.         <p class="centerit">
  201.           <span class="check">&#10003;</span>
  202.         </p>
  203.       </xsl:when>
  204.       <xsl:otherwise>
  205.         <xsl:attribute name="class">
  206.           <xsl:value-of select="$HealthColor"/>
  207.         </xsl:attribute>
  208.         <p class="centerit">
  209.           <xsl:value-of select="concat(CompletionPercentage,'%')"/>
  210.         </p>
  211.       </xsl:otherwise>
  212.     </xsl:choose>
  213.   </xsl:template>
  214. </xsl:stylesheet>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement