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

  1. <?xml version="1.0" ?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl" xmlns:CogTracker="http://www.rword.ru/tracker/">
  3. <xsl:template match="/">
  4.  
  5. <xsl:apply-templates select="./root"/>
  6.  
  7. </xsl:template>
  8.  
  9. <xsl:template match="root">
  10.     <!-- xsl:for-each select=".//*" -->
  11.         <xsl:apply-templates select="./CogTracker:ctDATABASE"/>
  12.     <!-- /xsl:for-each -->
  13. </xsl:template>
  14.  
  15. <xsl:script language="JScript"><![CDATA[
  16. var bRootNode = 1;
  17.  
  18. function fnGetRootNodeFlag() {
  19.     var bCurrentRoot = bRootNode;
  20.     bRootNode = 0;
  21.     return (bCurrentRoot != 0);
  22. };
  23.  
  24. var bTOCMode = 0;
  25. function fnGetTOCMode() {
  26.     return bTOCMode;
  27. };
  28.  
  29. function fnSetTOCMode(bMode) {
  30.     bTOCMode = bMode;
  31.     return "";
  32. };
  33. function fnIsURLEmpty(someNode) {
  34.     if (someNode != null) {
  35.         var sBaseURL = someNode.getAttribute("BaseURL");
  36.         if (sBaseURL != null) {
  37.             if (sBaseURL != "") {
  38.                 return true;
  39.             }
  40.         }
  41.     }
  42.  
  43.     return false;
  44. };
  45.  
  46. ]]></xsl:script>
  47.  
  48. <xsl:template match="CogTracker:ctDATABASE|CogTracker:ctNODE">
  49. <xsl:choose>
  50.  
  51.     <xsl:when expr="fnGetRootNodeFlag()">
  52.         <HTML>
  53.         <HEAD>
  54.         <TITLE>
  55.             <xsl:value-of select="@Name"/>
  56.         </TITLE>
  57.         <STYLE><![CDATA[
  58.             H2,H3 {
  59.                 font-family:  Verdana, sans-serif;
  60.                 font-size: 10pt;
  61.             };
  62.             BODY {
  63.                 font-family:  Verdana, sans-serif;
  64.                 font-size: 10pt;
  65.                 text-align: center;
  66.             };
  67.             TD.Contents {
  68.                                 BACKGROUND-COLOR: #f3f3f3;
  69.             };
  70.             DIV.ContentsEntry {
  71.                 font-family: Verdana, sans-serif;
  72.                 font-size: 10pt;
  73.                 text-align:left;
  74.                 margin-left: 15pt;
  75.             };
  76.             TABLE.Fragment, TD.FieldTitle, TD.FieldData {
  77.                 font-family: Verdana, sans-serif;
  78.                 font-size: 10pt;
  79.                 PADDING: 0px;
  80.                 MARGIN: 0px;
  81.                 VERTICAL-ALIGN: text-top;
  82.             };
  83.                         TD.FieldTitle {
  84.                 BACKGROUND-COLOR: #E0E0E0;
  85.                         };
  86.                         TD.FieldData {
  87.                             BACKGROUND-COLOR: #f3f3f3;
  88.                         };
  89.                         DIV.EmptyFolder {
  90.                             font-style: italic;
  91.                         };
  92.                         DIV.Source {
  93.                 PADDING-LEFT: 3px;
  94.                 PADDING-TOP: 0px;
  95.                 PADDING-BOTTOM: 0px;
  96.                 MARGIN-TOP: 0px;
  97.                 MARGIN-BOTTOM: 0px;
  98.                 DISPLAY: block;
  99.                 FLOAT: right;
  100.                 TEXT-ALIGN: right;
  101.                 VERTICAL-ALIGN: top;
  102.                 font-size: x-small;
  103.                         };
  104.                         TD.ContentsHead{
  105.                             text-align: center;
  106.                                 BACKGROUND-COLOR: #f3f3f3;
  107.                         };
  108.                         TD.FolderHead {
  109.                             text-align: center;
  110.                                 BACKGROUND-COLOR: #f3f3f3;
  111.                         };
  112.         ]]>
  113.         </STYLE>
  114.         </HEAD>
  115.         <BODY>
  116.         <DIV ALIGN="center" WIDTH="600px">
  117.  
  118.         <TABLE Class="TheData" COLS="1" WIDTH="600">
  119.  
  120.         <!-- following if is used to remove Contents generation section -->
  121.         <xsl:if test="./CogTracker:ctNODE//CogTracker:ctFRAGMENT">
  122.  
  123.         <TR>
  124.         <TD CLASS="ContentsHead">
  125.             <H2>Contents</H2>
  126.         </TD>
  127.                 </TR>
  128.  
  129.         <xsl:eval>fnSetTOCMode(true);</xsl:eval>
  130.  
  131.                 <TR>
  132.         <TD WIDTH="600" Class="Contents">
  133.         <DIV Class="ContentsEntry">
  134.                     <xsl:choose>
  135.                 <xsl:when test="./CogTracker:ctFRAGMENT">
  136.                     <A>
  137.                         <xsl:attribute name="HREF"
  138.                             >#href<xsl:value-of select="@UIN"
  139.                         /></xsl:attribute>
  140.                         <xsl:value-of select="@Name"/>
  141.                     </A>
  142.                 </xsl:when>
  143.                 <xsl:otherwise>
  144.  
  145.                 <xsl:choose>
  146.                     <xsl:when test=".//CogTracker:ctFRAGMENT">
  147.                         <xsl:value-of select="@Name"/>
  148.                     </xsl:when>
  149.  
  150.                     <xsl:otherwise>
  151.                         <DIV Class="EmptyFolder">
  152.                             There is no content to show.
  153.                         </DIV>
  154.                     </xsl:otherwise>
  155.                                 </xsl:choose>
  156.  
  157.                 </xsl:otherwise>
  158.             </xsl:choose>
  159.  
  160.  
  161.             <xsl:apply-templates
  162.                     select="./CogTracker:ctNODE"
  163.                     order-by="@Name"/>
  164.         </DIV>
  165.         </TD>
  166.         </TR>
  167.         </xsl:if>
  168.  
  169.  
  170.                 <xsl:eval>fnSetTOCMode(false);</xsl:eval>
  171.  
  172.         <xsl:if test="./CogTracker:ctFRAGMENT">
  173.             <TR><TD> </TD></TR>
  174.             <TR>
  175.             <TD Class="FolderHead">
  176.             <H2>
  177.             <A>
  178.                 <xsl:attribute name="NAME"
  179.                     >href<xsl:value-of select="@UIN"
  180.                 /></xsl:attribute>
  181.                     <xsl:value-of select="@Name"/>
  182.             </A>
  183.                         </H2>
  184.             </TD>
  185.             </TR>
  186.  
  187.             <TR>
  188.             <TD>
  189.             <xsl:apply-templates
  190.                 select="./CogTracker:ctFRAGMENT"
  191.                 order-by="-@CreationDate"/>
  192.             </TD>
  193.             </TR>
  194.         </xsl:if>
  195.  
  196.  
  197.         <xsl:apply-templates
  198.                 select="./CogTracker:ctNODE"
  199.                 order-by="@Name"/>
  200.  
  201.                 </TABLE>
  202.                 </DIV>
  203.                 </BODY>
  204.                 </HTML>
  205.     </xsl:when>
  206.     <xsl:otherwise>
  207.         <xsl:choose>
  208.             <xsl:when expr="fnGetTOCMode()">
  209.                 <DIV Class="ContentsEntry">
  210.  
  211.                     <xsl:choose>
  212.                         <xsl:when test="./CogTracker:ctFRAGMENT">
  213.                             <A>
  214.                                 <xsl:attribute name="HREF"
  215.                                     >#href<xsl:value-of select="@UIN"
  216.                                 /></xsl:attribute>
  217.                                 <xsl:value-of select="@Name"/>
  218.                             </A>
  219.                         </xsl:when>
  220.                         <xsl:otherwise>
  221.                             <xsl:if test=".//CogTracker:ctFRAGMENT">
  222.                                 <xsl:value-of select="@Name"/>
  223.  
  224.                             </xsl:if>
  225.                         </xsl:otherwise>
  226.                     </xsl:choose>
  227.  
  228.                     <xsl:apply-templates
  229.                         select="./CogTracker:ctNODE"
  230.                         order-by="@Name"/>
  231.                 </DIV>
  232.             </xsl:when>
  233.             <xsl:otherwise>
  234.                 <xsl:if test="./CogTracker:ctFRAGMENT">
  235.  
  236.                     <TR><TD> </TD></TR>
  237.                     <TR>
  238.                     <TD Class="FolderHead">
  239.                     <H3>
  240.  
  241.                     <A>
  242.                         <xsl:attribute name="NAME"
  243.                             >href<xsl:value-of select="@UIN"
  244.                         /></xsl:attribute>
  245.  
  246.                         <xsl:value-of select="@Name"/>
  247.                     </A>
  248.                     </H3>
  249.                     </TD>
  250.                     </TR>
  251.  
  252.  
  253.                     <TR>
  254.                     <TD>
  255.                     <xsl:apply-templates
  256.                         select="./CogTracker:ctFRAGMENT"
  257.                         order-by="-@CreationDate"/>
  258.                     </TD>
  259.                     </TR>
  260.                 </xsl:if>
  261.  
  262.                 <xsl:apply-templates
  263.                         select="./CogTracker:ctNODE"
  264.                         order-by="@Name"/>
  265.             </xsl:otherwise>
  266.         </xsl:choose>
  267.     </xsl:otherwise>
  268. </xsl:choose>
  269. </xsl:template>
  270.  
  271. <xsl:template match="CogTracker:ctFRAGMENT">
  272. <TABLE CLASS="Fragment" COLS="2" WIDTH="600">
  273. <TBODY>
  274.     <TR CLASS="TitleAndDate">
  275.         <TD CLASS="FieldTitle" WIDTH="3em">Title:
  276.         </TD>
  277.         <TD CLASS="FieldData" WIDTH="90%">
  278.             <xsl:if expr="fnIsURLEmpty(this)">
  279.             <!-- xsl:if test="@CreationDate" -->
  280.                 <!-- SPAN Class="Date" NAME="FragmentDate" ID="FragmentDate">
  281.                     <xsl:eval>(new Date(parseInt(this.selectSingleNode("@CreationDate").text, 10))).toLocaleString()</xsl:eval>
  282.                 </SPAN -->
  283.                 <DIV Class="Source" TITLE="Jump to citation source">| <A TARGET="_blank">
  284.                     <xsl:attribute name="HREF">
  285.                         <xsl:value-of select="@BaseURL"/>
  286.                     </xsl:attribute>
  287.                     Source...</A
  288.                 ></DIV>
  289.             </xsl:if>
  290.  
  291.             <DIV CLASS="FragmentTitle">
  292.                 <xsl:value-of select="@Name"
  293.             /></DIV>
  294.         </TD>
  295.     </TR>
  296.     <TR CLASS="Text">
  297.         <TD CLASS="FieldTitle" WIDTH="3em">
  298.             Text:
  299.         </TD>
  300.         <TD CLASS="FieldData" WIDTH="90%">
  301.             <DIV>
  302.             <xsl:value-of select="@Text"
  303.             />
  304.             </DIV>
  305.         </TD>
  306.     </TR>
  307.  
  308.     <TR CLASS="Comment">
  309.         <TD CLASS="FieldTitle" WIDTH="3em">Comment: </TD>
  310.         <TD CLASS="FieldData" WIDTH="90%">
  311.         <DIV>
  312.             <xsl:value-of select="@Comment"
  313.         /> </DIV></TD>
  314.     </TR>
  315.     <!-- TR CLASS="BaseURL">
  316.         <TD CLASS="FieldTitle">From: </TD>
  317.         <TD CLASS="FieldData">
  318.                 <A TARGET="_blank" CLASS="BaseURL">
  319.                     <xsl:attribute name="HREF">
  320.                         <xsl:value-of select="@BaseURL"/>
  321.                     </xsl:attribute>
  322.                     <xsl:value-of select="@BaseURL"
  323.             /></A>
  324.         </TD>
  325.     </TR -->
  326. </TBODY>
  327. <TFOOT>
  328. <TR>
  329. <TD COLSPAN="2">
  330. <HR></HR>
  331. </TD>
  332. </TR>
  333. </TFOOT>
  334. </TABLE>
  335. </xsl:template>
  336.  
  337.  
  338. </xsl:stylesheet>