home *** CD-ROM | disk | FTP | other *** search
/ com!online 2002 June / comonline0602.iso / software / cogitum / cociter.exe / CogitumH.___ / HTML / CTTREE.XSL < prev    next >
Encoding:
Extensible Markup Language  |  2001-08-08  |  4.0 KB  |  123 lines

  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"
  3.         xmlns:CogTracker="http://www.rword.ru/tracker/">
  4. <xsl:template match="/">
  5. <!-- HTML>
  6. <HEAD>
  7. <LINK rel="stylesheet" type="text/css" href="CogTrackerTree.css"/>
  8. <SCRIPT LANGUAGE="JScript" SRC="ctTree.js">
  9. </SCRIPT>
  10. <SCRIPT FOR="FoldersTree" EVENT="onSelectionChange">
  11. fnOnSelectionChange();
  12. </SCRIPT>
  13. </HEAD>
  14. <BODY -->
  15. <!-- onload="document.recalc(true); return true;" -->
  16.     <xsl:apply-templates select="/root/CogTracker:ctDATABASE"/>
  17. <!-- /BODY>
  18. </HTML -->
  19. </xsl:template>
  20.  
  21. <xsl:template match="/root">
  22.     <xsl:apply-templates select="CogTracker:ctDATABASE" order-by="@Name" />
  23. </xsl:template>
  24. <xsl:script language="JScript"><![CDATA[
  25. var uinCurrentNode = 0;
  26.  
  27. function fnIsCurrentNode(someUIN, someCurrentNode) {
  28.     if (someCurrentNode != null) {
  29.         uinCurrentNode = someCurrentNode;
  30.     };
  31.     
  32.         if ( someUIN == uinCurrentNode) {
  33.         return "true";
  34.     }
  35.     else {
  36.         return "false";
  37.     };
  38. };
  39.  
  40. var bIsExpandable = false;
  41. function fnIsExpandable(someNodes, bSetupFlag) {
  42.     if (bSetupFlag) {
  43.         bIsExpandable = (someNodes != null);
  44. /*
  45.         if (someNodes != null) {
  46.             bIsExpandable =  (someNodes.length > 0);
  47.         };
  48. */
  49.     };
  50.  
  51.     return ((bIsExpandable)?(true):(false));
  52. };
  53.  
  54. ]]></xsl:script>
  55.  
  56. <xsl:template match="CogTracker:ctDATABASE">
  57. <UL Class="FoldersTree" Name="FoldersTree" id="FoldersTree" onSelectionChange="top.fnOnTreeSelectionChange();">
  58.     <xsl:attribute name="UIN"><xsl:value-of select="@UIN" /></xsl:attribute>
  59.     <LI Class="FolderExpanded"> 
  60.         <xsl:attribute name="UIN"><xsl:value-of select="@UIN" /></xsl:attribute>
  61.  
  62.         <xsl:attribute name="IsDatabase">1</xsl:attribute>
  63.                 <xsl:attribute name="IsExpandable"><xsl:eval>fnIsExpandable(this.selectSingleNode("./CogTracker:ctNODE"), true);</xsl:eval></xsl:attribute>
  64.         <xsl:attribute name="IsExpanded">1</xsl:attribute>
  65.  
  66.         <NOBR Class="FolderNameNotFocused" name="FolderName">
  67.             <!-- xsl:when test="@UIN[.=../@CurrentNode[.]]" -->
  68.         <!-- xsl:attribute name="IsFocused"><xsl:value-of select=> </xsl:attribute -->
  69.             <!-- /xsl:when -->
  70.         <xsl:attribute name="IsFocused"><xsl:eval>fnIsCurrentNode(this.getAttribute("UIN"), this.getAttribute("CurrentNode"));</xsl:eval></xsl:attribute>
  71.  
  72.         <xsl:value-of select="@Name"/>
  73.  
  74.                 </NOBR>
  75.  
  76.         <xsl:if expr="fnIsExpandable(0, false)"> <!--test="./CogTracker:ctNODE"-->
  77.             <UL Class="SubTree" Name="SubTree" id="SubTree">
  78.                 <xsl:apply-templates
  79.                     select="./CogTracker:ctNODE[@IsUnsortedNode='1']"
  80.                     order-by="@Name" />
  81.                 <xsl:apply-templates
  82.                     select="./CogTracker:ctNODE[not(@IsUnsortedNode)]"
  83.                     order-by="@Name" />
  84.             </UL>
  85.         </xsl:if>
  86.     </LI>
  87. </UL>
  88. </xsl:template>
  89. <xsl:template match="CogTracker:ctNODE">
  90.     <LI Class="FolderCollapsed"> 
  91.         <xsl:attribute name="UIN"><xsl:value-of select="@UIN" /></xsl:attribute>
  92.  
  93.         <!-- xsl:if test="@UIN[. = /root/CogTracker:ctDATABASE/@CurrentNode[.]]">
  94.             <xsl:attribute name="SELECTED"/>
  95.         </xsl:if -->
  96.  
  97.         <xsl:attribute name="IsExpanded">0</xsl:attribute>
  98.                 <xsl:attribute name="IsExpandable"><xsl:eval>fnIsExpandable(this.selectSingleNode("./CogTracker:ctNODE"), true);</xsl:eval></xsl:attribute>
  99.                 <xsl:if test="@IsUnsortedNode">
  100.                     <xsl:attribute name="IsUnsortedNode">1</xsl:attribute>
  101.                 </xsl:if>
  102.         <xsl:attribute name="IsUnsorted">1</xsl:attribute>
  103.  
  104.         <NOBR Class="FolderNameNotFocused" name="FolderName">
  105.         <xsl:attribute name="IsFocused"><xsl:eval>fnIsCurrentNode(this.getAttribute("UIN"), null);</xsl:eval></xsl:attribute>
  106.         <!-- xsl:attribute name="Title"><xsl:value-of select="@Name"/></xsl:attribute -->
  107.         
  108.  
  109.         <xsl:value-of select="@Name"/>
  110.         </NOBR>
  111.  
  112.         <xsl:if expr="fnIsExpandable(0, false)"> <!--test="./CogTracker:ctNODE"-->
  113.             <UL Class="SubTree" Name="SubTree" id="SubTree">
  114.                 <xsl:apply-templates
  115.                     select="./CogTracker:ctNODE"
  116.                     order-by="@Name" />
  117.             </UL>
  118.         </xsl:if>
  119.     </LI> 
  120. </xsl:template>
  121.  
  122.  
  123. </xsl:stylesheet>