home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 October / INTERNET108.ISO / pc / software / windows / building / xmlspy / xmlspyentcomplete5.exe / Data1.cab / _B53EACEBBE2E40A5AF5AD205265C0237 < prev    next >
Encoding:
Extensible Markup Language  |  2002-09-13  |  19.2 KB  |  543 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  3. <xsl:output method="xml" version="1.0" encoding="UTF-8" omit-xml-declaration="no" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="xhtml1-transitional.dtd" indent="no" media-type="text/html"/>
  4.  
  5. <xsl:variable name="navigation_document" select="'navigation.xml'"/>
  6. <xsl:variable name="blocks_document" select="'blocks2.xml'"/>
  7. <xsl:variable name="currentsection" select="/main/idref"/>
  8.  
  9. <!--*************************************************-->
  10. <!--************************main**********************-->
  11. <!--*************************************************-->
  12.       <xsl:template match="main">
  13.          <html>
  14.              <xsl:call-template name="site_header"/>
  15.              <xsl:call-template name="display_site"/>
  16.        </html>
  17.       </xsl:template>
  18. <!--*************************************************-->
  19.       
  20. <!--*************************************************-->
  21. <!--************************site_header************-->
  22. <!--*************************************************-->
  23.       <xsl:template name="site_header">
  24.           <head>
  25.              <xsl:call-template name="page_title"/>
  26.                   <xsl:call-template name="css_insert"/>
  27.         </head>
  28.       </xsl:template>
  29. <!--*************************************************-->
  30.   
  31. <!--*************************************************-->
  32. <!--************************page_title************-->
  33. <!--*************************************************-->
  34.      <xsl:template name="page_title">
  35.            <title>
  36.                 <xsl:value-of select="/main/pagetitle"/>
  37.            </title>
  38.      </xsl:template>
  39. <!--*************************************************-->
  40.   
  41. <!--*************************************************-->
  42. <!--************************css_insert************-->
  43. <!--*************************************************-->
  44.      <xsl:template name="css_insert">
  45.          <link rel="stylesheet" type="text/css" media="screen" href="examplesite1.css"/>      
  46.      </xsl:template>
  47. <!--*************************************************-->
  48.   
  49.   
  50.   
  51. <!--*************************************************-->
  52. <!--************************display_site************-->
  53. <!--*************************************************-->
  54.     <xsl:template name="display_site">
  55.         <body>
  56.             <table class="formatter" cellspacing="0" cellpadding="0" border="0">
  57.                 <tr>
  58.                     <td class="banner">
  59.                         <xsl:call-template name="banner"/>
  60.                     </td>
  61.                 </tr>
  62.                 <tr>
  63.                     <td class="horizontaltoolbar">
  64.                          <xsl:call-template name="horizontaltoolbar"/>
  65.                     </td>
  66.                 </tr>
  67.                 <tr>
  68.                     <td>
  69.                         <table class="formatter" cellspacing="0" cellpadding="0" border="0">
  70.                             <tr>
  71.                                 <td class="verticletoolbar">
  72.                                     <xsl:call-template name="verticletoolbar"/>
  73.                                 </td>
  74.                                 <td class="maincontent">
  75.                                             <xsl:call-template name="maincontent"/>
  76.                                 </td>
  77.                                 <td class="flagbar">
  78.                                     <xsl:call-template name="flagbar"/>
  79.                                 </td>
  80.                             </tr>
  81.                         </table>
  82.                     </td>
  83.                 </tr>
  84.                 <tr>
  85.                     <td class="footer">
  86.                             <xsl:call-template name="footer"/>
  87.                     </td>
  88.                 </tr>
  89.             </table>
  90.         </body>
  91.     </xsl:template>
  92. <!--*************************************************-->
  93.   
  94. <!--*************************************************-->
  95. <!--************************flagbar******************-->
  96. <!--*************************************************-->
  97.     <xsl:template name="flagbar">
  98.         <div class="flagbar">
  99.              </div>
  100.     </xsl:template>
  101. <!--*************************************************-->
  102.   
  103. <!--*************************************************-->
  104. <!--************************banner*****************-->
  105. <!--*************************************************-->
  106.     <xsl:template name="banner">
  107.         <div class="banner">
  108.             <xsl:call-template name="handlepagefragment">
  109.                <xsl:with-param name="blockid">sample</xsl:with-param>
  110.             </xsl:call-template>
  111.              </div>
  112.     </xsl:template>
  113. <!--*************************************************-->
  114.   
  115. <!--*************************************************-->
  116. <!--************************horizontaltoolbar******-->
  117. <!--*************************************************-->
  118.     <xsl:template name="horizontaltoolbar">
  119.         <div class="horizontaltoolbar">
  120.              <xsl:for-each select="document($navigation_document)">
  121.                   <table cellpadding="0" cellspacing="0">
  122.                   <tr>
  123.                         <xsl:for-each select="navigation/menu/menu">
  124.                              <xsl:call-template name="htbitem"/>                        
  125.                         </xsl:for-each>
  126.                         </tr>
  127.                         </table>
  128.              </xsl:for-each>
  129.              </div>
  130.     </xsl:template>
  131. <!--*************************************************-->
  132.   
  133.   
  134. <!--*************************************************-->
  135. <!--************************htbitem*****************-->
  136. <!--*************************************************-->
  137.     <xsl:template name="htbitem">
  138.          <td > 
  139.            <xsl:call-template name="htbclass"/>
  140.             <a>
  141.                      <xsl:call-template name="htbclass"/>
  142.                <xsl:call-template name="menuurl"/>
  143.                <xsl:value-of select="title"/>
  144.             </a>
  145.          </td>
  146.     </xsl:template>
  147. <!--*************************************************-->
  148.  
  149. <xsl:template name="htbclass">
  150.    <xsl:attribute name="class">
  151.         <xsl:choose>
  152.         <xsl:when test="descendant-or-self::*[id=$currentsection]">
  153.             selectedhtbitem
  154.         </xsl:when>
  155.         <xsl:otherwise>
  156.             htbitem
  157.         </xsl:otherwise>
  158.     </xsl:choose>
  159.    </xsl:attribute>
  160. </xsl:template>
  161.  
  162. <!--*************************************************-->
  163. <!--************************menuurl******-->
  164. <!--*************************************************-->
  165.     <xsl:template name="menuurl">
  166.         <xsl:attribute name="href">
  167.         <xsl:copy-of select="."/>
  168.         <xsl:choose>
  169.                <xsl:when test="count(idref)>0">
  170.                     <xsl:call-template name="lookupmenu">
  171.                         <xsl:with-param name="menuid">
  172.                            <xsl:value-of select="idref"/>
  173.                         </xsl:with-param>
  174.                     </xsl:call-template>
  175.                </xsl:when>
  176.                <xsl:when test="url">
  177.                     <xsl:value-of select="url"/>
  178.                </xsl:when>
  179.                <xsl:when test="count(menu)>0">
  180.                   <xsl:for-each select="menu">
  181.                          <xsl:if test="position()=1">
  182.                                <xsl:call-template name="url"/>                 
  183.                          </xsl:if>
  184.                      </xsl:for-each>
  185.                 </xsl:when>
  186.            </xsl:choose>
  187.         </xsl:attribute>
  188.     </xsl:template>
  189. <!--*************************************************-->
  190.  
  191.  
  192. <!--*************************************************-->
  193. <!--************************lookupmenu******-->
  194. <!--*************************************************-->
  195.     <xsl:template name="lookupmenu">
  196.         <xsl:param name="menuid"/>lookup
  197.            <xsl:for-each select="document($navigation_document)//menu">
  198.                  <xsl:if test="id=$menuid">
  199.                         <xsl:call-template name="url"/>                 
  200.                  </xsl:if>
  201.         </xsl:for-each>
  202.     </xsl:template>
  203. <!--*************************************************-->
  204.  
  205.  
  206.  
  207. <!--*************************************************-->
  208. <!--************************url******-->
  209. <!--*************************************************-->
  210.     <xsl:template name="url">
  211.        <xsl:choose>
  212.         <xsl:when test="url">
  213.             <xsl:value-of select="url"/>
  214.         </xsl:when>
  215.              <xsl:otherwise>
  216.                    <xsl:for-each select="menu">
  217.                          <xsl:if test="position()=1">
  218.                                <xsl:call-template name="url"/>                 
  219.                          </xsl:if>
  220.                        </xsl:for-each>
  221.              </xsl:otherwise>        
  222.          </xsl:choose>
  223.     </xsl:template>
  224. <!--*************************************************-->
  225.  
  226.   
  227. <!--*************************************************-->
  228. <!--************************maincontent*****************-->
  229. <!--*************************************************-->
  230.     <xsl:template name="maincontent">
  231.         <div class="maincontent">
  232.            <xsl:apply-templates select="/main/content"/>
  233.              </div>
  234.     </xsl:template>
  235. <!--*************************************************-->
  236.   
  237. <!--*************************************************-->
  238. <!--************************verticletoolbar************-->
  239. <!--*************************************************-->
  240.     <xsl:template name="verticletoolbar">
  241.              <xsl:for-each select="document($navigation_document)">
  242.                         <xsl:for-each select="navigation/menu/menu">
  243.                             <xsl:choose>
  244.                             <xsl:when test="descendant-or-self::*[id=$currentsection]">
  245.                                          <xsl:call-template name="rendervtb"/>               
  246.                             </xsl:when>
  247.                         </xsl:choose>
  248.                         </xsl:for-each>
  249.              </xsl:for-each>
  250.     </xsl:template>
  251. <!--*************************************************-->
  252.   
  253. <!--*************************************************-->
  254. <!--************************rendervtb************-->
  255. <!--*************************************************-->
  256.     <xsl:template name="rendervtb">
  257.         <div class="verticletoolbar">
  258.            <table cellpadding="0"    cellspacing="0">
  259.                   <xsl:for-each select="menu">
  260.                   <tr>
  261.                      <td > 
  262.                            <xsl:call-template name="vtbclass"/>
  263.                            <a>
  264.                                      <xsl:call-template name="vtbclass"/>
  265.                                <xsl:call-template name="menuurl"/>
  266.                                <xsl:value-of select="title"/>
  267.                              </a>
  268.                            </td>
  269.                      </tr>
  270.                   </xsl:for-each>
  271.            </table>
  272.            </div>
  273.        </xsl:template>
  274. <!--*************************************************-->
  275.   
  276.   <xsl:template name="vtbclass">
  277.    <xsl:attribute name="class">
  278.         <xsl:choose>
  279.         <xsl:when test="descendant-or-self::*[id=$currentsection]">
  280.             selectedvtbitem
  281.         </xsl:when>
  282.         <xsl:otherwise>
  283.             vtbitem
  284.         </xsl:otherwise>
  285.     </xsl:choose>
  286.    </xsl:attribute>
  287. </xsl:template>
  288.  
  289.  
  290.   
  291.   
  292. <!--*************************************************-->
  293. <!--************************footer************-->
  294. <!--*************************************************-->
  295.     <xsl:template name="footer">
  296.         <div class="footer">
  297.              </div>
  298.     </xsl:template>
  299. <!--*************************************************-->
  300.  
  301. <!--*************************************************-->
  302. <!--************************pagefragment************-->
  303. <!--*************************************************-->
  304.        <xsl:template match="pagefragment">
  305.        <xsl:choose>
  306.            <xsl:when test="count(@idref)>0">
  307.                  <xsl:call-template name="handlepagefragment">
  308.                        <xsl:with-param name="blockid" select="@idref"/>
  309.                  </xsl:call-template>
  310.            </xsl:when>
  311.            <xsl:otherwise>
  312.                    <div style="fragment">
  313.                          <xsl:apply-templates select="*"/>
  314.                    </div> 
  315.            </xsl:otherwise>
  316.     </xsl:choose>
  317.        </xsl:template>
  318. <!--*************************************************-->
  319.  
  320. <!--*************************************************-->
  321. <!--************************handlepagefragment************-->
  322. <!--*************************************************-->
  323.        <xsl:template name="handlepagefragment">
  324.        <xsl:param name="blockid"/>
  325.            <xsl:for-each select="document('blocks.xml')">
  326.                  <xsl:for-each select="//block_instance">
  327.                      <xsl:choose>
  328.                          <xsl:when test="id=$blockid">
  329.                               <xsl:apply-templates select="pagefragment"/>
  330.                          </xsl:when>
  331.                      </xsl:choose>
  332.                  </xsl:for-each> 
  333.            </xsl:for-each>
  334.        </xsl:template>
  335. <!--*************************************************-->
  336.   
  337.   
  338. <!--*************************************************-->
  339. <!--************************table************-->
  340. <!--*************************************************-->
  341.       <xsl:template match="table">
  342.           <table border="0" style="width:100%;" cellspacing="0" cellpadding="0">
  343.                <xsl:for-each select="tr">
  344.                      <tr>
  345.                          <xsl:for-each select="td">
  346.                             <td>
  347.                                 <xsl:if test="count(@style)>0"><xsl:attribute name="style"><xsl:value-of select="@style"/></xsl:attribute></xsl:if>
  348.                                  <xsl:apply-templates/>
  349.                            </td>
  350.                          </xsl:for-each>                     
  351.                      </tr>               
  352.                </xsl:for-each>
  353.           </table>
  354.           <br/>
  355.       </xsl:template>
  356. <!--*************************************************-->
  357.   
  358. <!--*************************************************-->
  359. <!--************************list************-->
  360. <!--*************************************************-->
  361.       <xsl:template match="list">
  362.           <br/>
  363.           <table border="0" style="width:100%;" cellspacing="0" cellpadding="0">
  364.                <xsl:for-each select="listitem">
  365.                      <tr>
  366.                             <td>
  367.                                      <xsl:apply-templates/>
  368.                            </td>
  369.                      </tr>               
  370.                      <tr>
  371.                        <td class="listseperator"> 
  372.                             <img src="images/blank.gif" alt="." class="listseperator"/>
  373.                        </td> 
  374.                        </tr>
  375.                </xsl:for-each>
  376.           </table>
  377.       </xsl:template>
  378. <!--*************************************************-->
  379.   
  380. <!--*************************************************-->
  381. <!--************************header************-->
  382. <!--*************************************************-->
  383.     <xsl:template match="header">
  384.         <span class="pageheader">  
  385.              <xsl:apply-templates/>
  386.          </span>
  387.     </xsl:template>
  388. <!--*************************************************-->
  389.   
  390. <!--*************************************************-->
  391. <!--************************img************-->
  392. <!--*************************************************-->
  393.     <xsl:template match="img">
  394.        <img alt="">
  395.           <xsl:attribute name="src">
  396.                   <xsl:value-of select="@src"/>
  397.           </xsl:attribute>
  398.        </img>
  399.     </xsl:template>
  400. <!--*************************************************-->
  401.  
  402. <!--*************************************************-->
  403. <!--************************para************-->
  404. <!--*************************************************-->
  405.     <xsl:template match="para">
  406.        <p>
  407.          <xsl:apply-templates/>
  408.        </p>
  409.     </xsl:template>
  410. <!--*************************************************-->
  411.  
  412. <!--*************************************************-->
  413. <!--************************br************-->
  414. <!--*************************************************-->
  415.     <xsl:template match="br">
  416.       <br/>
  417.     </xsl:template>
  418. <!--*************************************************-->
  419.  
  420. <!--*************************************************-->
  421. <!--************************strong************-->
  422. <!--*************************************************-->
  423.     <xsl:template match="bold">
  424.       <b>
  425.          <xsl:apply-templates/>
  426.       </b>
  427.     </xsl:template>
  428. <!--*************************************************-->
  429.  
  430. <!--*************************************************-->
  431. <!--************************link************-->
  432. <!--*************************************************-->
  433.     <xsl:template match="link">
  434.       <a>
  435.          <xsl:choose>
  436.             <xsl:when test="idref">
  437.                 <xsl:call-template name="link_url">
  438.                   <xsl:with-param name="linkid"><xsl:value-of select="idref"/></xsl:with-param>
  439.                 </xsl:call-template>
  440.             </xsl:when>
  441.            <xsl:otherwise>
  442.              <xsl:attribute name="href"><xsl:value-of select="url"/></xsl:attribute>
  443.            </xsl:otherwise>
  444.          </xsl:choose>
  445.          <xsl:if test="count(@target)>0">
  446.             <xsl:attribute name="target">
  447.               <xsl:value-of select="@target"/>
  448.               </xsl:attribute>
  449.           </xsl:if>
  450.          <xsl:apply-templates select="bold | br | img | span| text() "/>
  451.       </a>
  452.     </xsl:template>
  453. <!--*************************************************-->
  454.  
  455.  
  456. <xsl:template name="link_url">
  457.    <xsl:param name="linkid"/>
  458.    <xsl:for-each select="document($navigation_document)//menu">
  459.       <xsl:if test="$linkid=id">
  460.         <xsl:attribute name="href">
  461.         <xsl:call-template name="menu_url"/>
  462.         </xsl:attribute>
  463.       </xsl:if>
  464.    </xsl:for-each>
  465. </xsl:template>
  466.  
  467. <xsl:template name="menu_url">
  468.         <xsl:choose>
  469.             <xsl:when test="count(idref)>0">
  470.                 <xsl:call-template name="menu_ref_url">
  471.                     <xsl:with-param name="menu_id">
  472.                         <xsl:value-of select="idref"/>
  473.                     </xsl:with-param>
  474.                 </xsl:call-template>
  475.             </xsl:when>
  476.             <xsl:otherwise>
  477.                 <xsl:choose>
  478.                     <xsl:when test="url">
  479.                         <xsl:value-of select="url"/>
  480.                     </xsl:when>
  481.                     <xsl:when test="menu[1]/url">
  482.                         <xsl:value-of select="menu[1]/url"/>
  483.                     </xsl:when>
  484.                     <xsl:when test="menu[1]/menu[1]/url">
  485.                         <xsl:value-of select="menu[1]/menu[1]/url"/>
  486.                     </xsl:when>
  487.                     <xsl:when test="menu[1]/menu[1]/menu[1]/url">
  488.                         <xsl:value-of select="menu[1]/menu[1]/menu[1]/url"/>
  489.                     </xsl:when>
  490.                     <xsl:when test="menu[1]/menu[1]/menu[1]/menu[1]/url">
  491.                         <xsl:value-of select="menu[1]/menu[1]/menu[1]/menu[1]/url"/>
  492.                     </xsl:when>
  493.                 </xsl:choose>
  494.             </xsl:otherwise>
  495.         </xsl:choose>
  496.     </xsl:template>
  497.  
  498.  
  499.  
  500.  
  501. <xsl:template name="menu_ref_url">
  502.         <xsl:param name="menu_id"/>
  503.         <xsl:for-each select="document($navigation_document)//menu">
  504.             <xsl:if test="id=$menu_id">
  505.                 <xsl:choose>
  506.                     <xsl:when test="idref">
  507.                         <xsl:call-template name="menu_ref_url">
  508.                             <xsl:with-param name="menu_id">
  509.                                 <xsl:value-of select="idref"/>
  510.                             </xsl:with-param>
  511.                         </xsl:call-template>
  512.                     </xsl:when>
  513.                     <xsl:when test="idref">
  514.                         <xsl:call-template name="menu_ref_url">
  515.                             <xsl:with-param name="menu_id">
  516.                                 <xsl:value-of select="idref"/>
  517.                             </xsl:with-param>
  518.                         </xsl:call-template>
  519.                     </xsl:when>
  520.                     <xsl:when test="url">
  521.                         <xsl:value-of select="url"/>
  522.                     </xsl:when>
  523.                     <xsl:when test="menu[1]/url">
  524.                         <xsl:value-of select="menu[1]/url"/>
  525.                     </xsl:when>
  526.                     <xsl:when test="menu[1]/menu[1]/url">
  527.                         <xsl:value-of select="menu[1]/menu[1]/url"/>
  528.                     </xsl:when>
  529.                     <xsl:when test="menu[1]/menu[1]/menu[1]/url">
  530.                         <xsl:value-of select="menu[1]/menu[1]/menu[1]/url"/>
  531.                     </xsl:when>
  532.                     <xsl:when test="menu[1]/menu[1]/menu[1]/menu[1]/url">
  533.                         <xsl:value-of select="menu[1]/menu[1]/menu[1]/menu[1]/url"/>
  534.                     </xsl:when>
  535.                 </xsl:choose>
  536.             </xsl:if>
  537.         </xsl:for-each>
  538.     </xsl:template>
  539.  
  540.  
  541.  
  542. </xsl:stylesheet>
  543.