home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2002 December / DPPCPRO1202.ISO / Extras / Assistum / setup.exe / Complete_Listing.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2001-10-15  |  13.2 KB  |  415 lines

  1. <?xml version="1.0" ?>
  2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  3. <xsl:output method = "html" encoding = "iso-8859-1"/> 
  4.  
  5. <!-- Variables relate as follows: 
  6.  
  7. 'hc' gives header colour,'bgc' the overall display background 
  8. colour and 'tbgc' the table background colour.
  9. All colours are in hexadecimal.
  10. 'width' gives the overall width of the display in pixels.-->
  11.  
  12.  
  13.  
  14. <xsl:variable name ='hc'>#008080</xsl:variable>
  15. <xsl:variable name ='bgc'>#FFFFFF</xsl:variable>
  16. <xsl:variable name ='tbgc'>#008080</xsl:variable>
  17. <xsl:variable name ='width'>800</xsl:variable>
  18.  
  19.  
  20.  
  21. <xsl:template match="/">
  22.         <HTML>
  23.     <HEAD>
  24.         
  25.         <TITLE>Complete Listing</TITLE>
  26.                 <STYLE TYPE = "text/css">
  27.                 
  28.                 A {font-weight: bold}
  29.                 A:link {color: slateblue; text-decoration: none;}
  30.                 A:active {color: blue; text-decoration: none;}
  31.                 A:visited{color: darkslateblue; text-decoration: none;}
  32.                 A:hover {color: red; text-decoration: underline;}
  33.  
  34.                 </STYLE>
  35.          
  36.                 <SCRIPT LANGUAGE="JavaScript">
  37.                 <xsl:comment>
  38.                 {
  39.                    var result;
  40.                    
  41.                    function convert(red,green,blue)
  42.                    {
  43.                       result = red+''+green+''+blue;
  44.                       document.write(result);
  45.                    }
  46.                 }
  47.                 </xsl:comment>
  48.                 </SCRIPT>
  49.                                <SCRIPT LANGUAGE="JavaScript">
  50.         <xsl:comment>
  51.         
  52.  
  53. var days = new Array(8);
  54. days[1] = "Sunday";
  55. days[2] = "Monday";
  56. days[3] = "Tuesday";
  57. days[4] = "Wednesday";
  58. days[5] = "Thursday";
  59. days[6] = "Friday";
  60. days[7] = "Saturday";
  61. var months = new Array(13);
  62. months[1] = "January";
  63. months[2] = "February";
  64. months[3] = "March";
  65. months[4] = "April";
  66. months[5] = "May";
  67. months[6] = "June";
  68. months[7] = "July";
  69. months[8] = "August";
  70. months[9] = "September";
  71. months[10] = "October";
  72. months[11] = "November";
  73. months[12] = "December";
  74.  
  75. function printDate()
  76. {
  77. var dateObj = new Date(document.lastModified)
  78. var minute = dateObj.getMinutes()
  79. if(minute<10)
  80.     minute = "0"+minute;
  81. var hour = dateObj.getHours()
  82. if(hour<10)
  83.     hour = "0"+hour; 
  84. var wday = days[dateObj.getDay() + 1]
  85. var lmonth = months[dateObj.getMonth() + 1]
  86. var month = dateObj.getMonth()+1
  87. if(month<10)
  88.     month = "0"+month; 
  89. var date = dateObj.getDate()
  90. if(date<10)
  91.     date = "0"+date;
  92. var fyear = dateObj.getYear()
  93. if(fyear<1900)
  94.    fyear=fyear+1900;
  95. document.write("Report created : "+hour+": "+minute+",  "+date+ "/ "+month+"/ "+fyear)
  96. // End 
  97. }
  98.  
  99. function printScenarioDate(hour,minute,day,month,year)
  100. {
  101. var lmonth = months[month]
  102. document.write("Scenario last modified : "+hour+": "+minute+", "+lmonth+" " +day+", "+year)
  103. }        
  104.         </xsl:comment>
  105.         </SCRIPT>
  106.  
  107.         </HEAD>
  108.         
  109.        
  110.     <BODY BGCOLOR = "{$bgc}">
  111.  
  112.         <CENTER>
  113.         <TABLE>
  114.         <TBODY>
  115.         <TR>
  116.         <TD VALIGN="TOP" WIDTH="73%" HEIGHT="15" BGCOLOR="$tbgc">
  117.         <CENTER><FONT FACE="Arial" COLOR="#FFFFFF" SIZE="+1">Report</FONT>
  118.         <br/><FONT FACE="Arial" COLOR="#FFFFFF" SIZE="+1">Complete Listing</FONT></CENTER>
  119.         </TD>
  120.         </TR>
  121.         </TBODY>
  122.         </TABLE>
  123.         </CENTER>
  124.         
  125.         <CENTER>
  126.         <B><FONT FACE = "Times New Roman, Times, serif" color="#000000" size="3">
  127.         <SMALL>
  128.        
  129.         <SCRIPT> 
  130.         printDate();
  131.         </SCRIPT>
  132.         <br/>
  133.         
  134.         
  135.         
  136.         </SMALL>       
  137.         </FONT>
  138.         </B>  
  139.         </CENTER>
  140.         <FONT SIZE = "+1">
  141.         <xsl:apply-templates mode = "main"/>
  142.         
  143.         
  144.         <xsl:apply-templates/>
  145.         </FONT>
  146.         
  147.         </BODY>
  148.         
  149.         </HTML> 
  150.  
  151. </xsl:template>
  152.  
  153.  
  154.         
  155.  
  156.  
  157.  
  158.  
  159. <xsl:template match = "assistumdocument" mode = "main">
  160.         <xsl:for-each select = "assistumnetwork">
  161.         
  162.         <xsl:variable name = "headernumber">
  163.         <xsl:number format = "1" count = "assistumnetwork"/>
  164.         </xsl:variable>
  165.         
  166.            <xsl:variable name = "red" select = "network/networkname/colour/@red"/>
  167.            <xsl:variable name = "green" select = "network/networkname/colour/@green"/>
  168.            <xsl:variable name = "blue" select = "network/networkname/colour/@blue"/>
  169.  
  170.            <xsl:variable name = "colour" select = "concat($red,$green,$blue)"/>
  171.             
  172.            <!--SCRIPT>
  173.            var red = <xsl:value-of select = "$red"/>;
  174.            var green = <xsl:value-of select = "$green"/>;
  175.            var blue = <xsl:value-of select = "$blue"/>;
  176.            convert(red,green,blue);
  177.            </SCRIPT-->
  178.             
  179.            
  180.         
  181.         <H3><FONT COLOR = "{$hc}">
  182.         <xsl:value-of select = "$headernumber"/>
  183.           
  184.         <xsl:value-of select = "network/networkname/string"/>
  185.        
  186.         <br/>
  187.         <br/>
  188.         <xsl:if test = "string-length(network/scenarioname/string)!=0">
  189.         <xsl:value-of select = "network/scenarioname/string"/>
  190.         <br/>
  191.         <br/>
  192.         
  193.         </xsl:if>
  194.         <!--br/>
  195.         <xsl:value-of select = "network/networkdescription/string"/--> 
  196.         </FONT></H3>  
  197.         <OL><xsl:for-each select = "node[not(disabled = 'true')]">
  198.         <xsl:variable name = "number">
  199.           <xsl:value-of select = "$headernumber"/>
  200.           .
  201.           <xsl:number value = "position()" format = "1"/>
  202.         </xsl:variable>
  203.     <xsl:choose>
  204.     <xsl:when test = "disabled = 'true'"/>
  205.        
  206.     <xsl:otherwise>
  207.        <H3><FONT COLOR = "{$hc}">
  208.        
  209.        <xsl:value-of select = "$number"/>          
  210.        :   
  211.        <xsl:value-of select = "nodename/string"/></FONT></H3>
  212.        <xsl:if test = "string-length(question/string) != 0">       
  213.        Question:  <B><xsl:value-of select = "question/string"/></B>
  214.        <br/>
  215.        </xsl:if>
  216.        <xsl:if test = "string-length(reason/string) != 0">  
  217.        Reference:  <xsl:value-of select = "reason/string"/>
  218.        <br/>
  219.        </xsl:if>
  220.  
  221.        <xsl:choose>
  222.  
  223.        <xsl:when test = "answered = 'true'">
  224.        <xsl:variable name = "answernumber">
  225.        <xsl:variable name = "numbanswers" select = "(count(answer))"/>
  226.        <xsl:value-of select = "((($numbanswers)-1)*(1-answervalue))+1"/>
  227.        </xsl:variable>
  228.     <xsl:choose>
  229.     <xsl:when test = "($answernumber*10) mod 10 = '5'">
  230.     Answer:    <B>Between <xsl:value-of select = "answer[index=ceiling($answernumber)]/string"/>
  231.      and <xsl:value-of select = "answer[index=floor($answernumber)]/string"/></B>
  232.     <br/>
  233.     </xsl:when>
  234.     <xsl:otherwise>
  235.        Answer:    <B><xsl:value-of select = "answer[index = round($answernumber)]/string"/></B>
  236.     <br/>
  237.            </xsl:otherwise>
  238.     </xsl:choose>
  239.  
  240.         <xsl:choose>
  241.         <xsl:when test = "degreeoftruth = answervalue"/>
  242.         <xsl:otherwise>
  243.         <xsl:variable name = "machineanswernumber">
  244.        <xsl:variable name = "numbanswers" select = "(count(answer))"/>
  245.        <xsl:value-of select = "((($numbanswers)-1)*(1-degreeoftruth))+1"/>
  246.        </xsl:variable>
  247.         <FONT COLOR = "#FF0000"> 
  248.         The Knowledge Base disagreed: It gave the following answer :
  249.         </FONT>
  250.         <br/>
  251.     <xsl:choose>
  252.     <xsl:when test = "($machineanswernumber*10) mod 10 = '5'">
  253.     Answer:    <B>Between <xsl:value-of select = "answer[index=ceiling($machineanswernumber)]/string"/>
  254.      and <xsl:value-of select = "answer[index=floor($machineanswernumber)]/string"/></B>
  255.     <br/>
  256.     </xsl:when>
  257.     <xsl:otherwise>
  258.        Answer:    <B><xsl:value-of select = "answer[index = round($machineanswernumber)]/string"/></B>
  259.     <br/>
  260.            </xsl:otherwise>
  261.     </xsl:choose>
  262.         </xsl:otherwise>
  263.         </xsl:choose>
  264.            </xsl:when>
  265.  
  266.        <xsl:otherwise>
  267.            <FONT COLOR = "#FF0000"><B>This question has not been answered</B></FONT>
  268.     <br/>
  269.     -<!--<xsl:if test = "default = 'true'">
  270.                <xsl:variable name = "answernumber">
  271.                <xsl:variable name = "numbanswers" select = "(count(answer))"/>
  272.                <xsl:value-of select = "((($numbanswers)-1)*(1-defaultanswervalue))+1"/>
  273.                </xsl:variable>
  274.         <xsl:choose>
  275.         <xsl:when test = "($answernumber*10) mod 10 = '5'">
  276.         Default Answer:    <B>Between <xsl:value-of select = "answer[index=ceiling($answernumber)]/string"/>
  277.          and <xsl:value-of select = "answer[index=floor($answernumber)]/string"/></B>
  278.         </xsl:when>
  279.         <xsl:otherwise>
  280.                Default Answer:    <B><xsl:value-of select = "answer[index = round($answernumber)]/string"/></B>
  281.                </xsl:otherwise>
  282.         </xsl:choose>
  283.     </xsl:if>
  284.        
  285. --></xsl:otherwise>
  286.        
  287.     </xsl:choose>
  288.            <br/>
  289.        
  290.        <xsl:if test = "string-length(moreinfo) != 0">
  291.        More Information:  <xsl:value-of select = "moreinfo"/>
  292.        <br/><br/>
  293.        </xsl:if>
  294.  
  295.            </xsl:otherwise>
  296.     </xsl:choose>
  297.        <xsl:if test = "string-length(external/@linkedkb) != '0'">
  298.        <xsl:call-template name = "linkednode">
  299.          <xsl:with-param name = "kbref" select = "external/@linkedkb"/>
  300.          <xsl:with-param name = "transfernumber" select = "$number"/> 
  301.        </xsl:call-template>
  302.        </xsl:if>
  303.        </xsl:for-each>
  304.        </OL>
  305.        </xsl:for-each> 
  306. </xsl:template>
  307.  
  308. <xsl:template name = "linkednode">
  309.        <xsl:param name = "kbref"/>
  310.        <xsl:param name = "transfernumber"/> 
  311.        
  312.        <!--Number is :<xsl:value-of select = "$transfernumber"/-->
  313.        <xsl:apply-templates select = "document($kbref)" mode = "heading"/>
  314.        <xsl:apply-templates select = "document($kbref)" mode = "main">
  315.        <xsl:with-param name = "currnumber" select = "$transfernumber"/>
  316.        </xsl:apply-templates>
  317. </xsl:template>
  318.  
  319.  
  320.  
  321. <xsl:template name = "lastmodified">
  322.        <xsl:variable name = "datetime" select = "network/lastmodified"/>
  323.        
  324.        <xsl:variable name = "tempmonth" select = "substring-before($datetime,'/')"/>
  325.        <xsl:variable name = "firstrem" select = "substring-after($datetime,'/')"/>
  326.        <xsl:variable name = "tempday" select = "substring-before($firstrem,'/')"/>
  327.        <xsl:variable name = "secondrem" select = "substring-after($firstrem,'/')"/>
  328.        <xsl:variable name = "year" select = "substring-before($secondrem,' ')"/>
  329.        <xsl:variable name = "thirdrem" select = "substring-after($secondrem,' ')"/>
  330.        <xsl:variable name = "temphour" select = "substring-before($thirdrem,':')"/>
  331.        <xsl:variable name = "fourthrem" select = "substring-after($thirdrem,':')"/>
  332.        <xsl:variable name = "minute" select = "substring-before($fourthrem,':')"/>
  333.        <xsl:variable name = "ampm" select = "substring-after($fourthrem,' ')"/> 
  334.        <xsl:variable name = "hour">
  335.        <xsl:choose>
  336.          <xsl:when test = "$ampm = 'PM'">
  337.             <xsl:choose>
  338.                <xsl:when test = "$temphour = '12'">
  339.                <xsl:value-of select = "$temphour"/>
  340.                </xsl:when> 
  341.                <xsl:otherwise>
  342.                <xsl:value-of select = "$temphour + 12"/>
  343.                </xsl:otherwise>
  344.             </xsl:choose>
  345.          </xsl:when>
  346.          <xsl:otherwise>
  347.             <xsl:choose>
  348.                <xsl:when test = "$temphour = '12'">
  349.                00
  350.                </xsl:when>
  351.                <xsl:otherwise>
  352.                  <xsl:choose>
  353.                  <xsl:when test = "$temphour < '10'">
  354.                  0<xsl:value-of select = "$temphour"/>
  355.                  </xsl:when>
  356.                  <xsl:otherwise>
  357.                  <xsl:value-of select = "$temphour"/>
  358.                  </xsl:otherwise>
  359.                  </xsl:choose>
  360.                </xsl:otherwise>
  361.              </xsl:choose>
  362.          </xsl:otherwise>
  363.        </xsl:choose>
  364.        </xsl:variable>
  365.        <xsl:variable name = "day"> 
  366.        <xsl:choose>
  367.        <xsl:when test = "$tempday < '10'">
  368.        0<xsl:value-of select = "$tempday"/>
  369.        </xsl:when>
  370.        <xsl:otherwise>
  371.        <xsl:value-of select = "$tempday"/>
  372.        </xsl:otherwise>
  373.        </xsl:choose> 
  374.        </xsl:variable>           
  375.        <xsl:variable name = "month"> 
  376.        <xsl:choose>
  377.        <xsl:when test = "$tempmonth < '10'">
  378.        0<xsl:value-of select = "$tempmonth"/>
  379.        </xsl:when>
  380.        <xsl:otherwise>
  381.        <xsl:value-of select = "$tempmonth"/>
  382.        </xsl:otherwise>
  383.        </xsl:choose> 
  384.        </xsl:variable>            
  385.   
  386.        <CENTER>
  387.        <FONT FACE = "Times New Roman, Times, serif" color="#000000" size="3">
  388.        <SMALL>
  389.        Scenario last modified : 
  390.        <xsl:value-of select = "$hour"/>:
  391.        <xsl:value-of select = "$minute"/>,  
  392.        <xsl:value-of select = "$day"/>/
  393.        <xsl:value-of select = "$month"/>/
  394.        <xsl:value-of select = "$year"/>
  395.        
  396.        <!--SCRIPT>
  397.        printScenarioDate(hour,minute,day,month,year);
  398.        </SCRIP--> 
  399.        </SMALL>
  400.        </FONT>
  401.        </CENTER>
  402. </xsl:template>
  403. <xsl:template match = "assistumdocument"/>
  404.  
  405. </xsl:stylesheet>
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.