home *** CD-ROM | disk | FTP | other *** search
/ Clickx 75 / Clickx 75.iso / software / expressionweb / expressionwebv3 / ExpressionWeb_en.exe / Setup / WeConen.cab / xweb.horizontal.HORIZ.XSL.en < prev    next >
Encoding:
Extensible Markup Language  |  2009-06-09  |  7.5 KB  |  225 lines

  1. <?xml version="1.0" ?> 
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
  3.  
  4. <xsl:script>
  5.       <![CDATA[
  6.   var gMaxHeight = 0;
  7.     var gnumPerRow = ""
  8.  
  9.   function breakRow(e) {
  10.         if (gnumPerRow == "") {
  11.             gnumPerRow = e.selectSingleNode("//options").getAttribute("numperrow");
  12.         }
  13.         return ((absoluteChildNumber(e) - 1)%gnumPerRow) == 0;
  14.   } 
  15.  
  16.   function notPreviewOutput(e) {
  17.         if (e.selectSingleNode("/xml[@output='preview']")) {
  18.             return false;
  19.         } else {
  20.             return true;
  21.         }
  22.   }
  23.  
  24.   function NBSP()
  25.   {
  26.         return "if (navigator.appName == \"Netscape\" && parseInt(navigator.appVersion) < 5)\ndocument.write(\"<td bgcolor='#000000' width='1'> </td>\");";
  27.   }
  28.       
  29.   function rowEnd(e) {
  30.         if (gnumPerRow == "") {
  31.             gnumPerRow = e.selectSingleNode("//options").getAttribute("numperrow");
  32.         }
  33.         var childList = e.selectSingleNode("//pictures").childNodes;
  34.         return ((absoluteChildNumber(e))%gnumPerRow) == 0 || childList.length == absoluteChildNumber(e);
  35.   } 
  36.     
  37.     //generate a random int to identify the functions and objects in this gallery
  38.     var rnd = Math.round(Math.random() * 10000);    
  39.  
  40.   function setMaxHeight(e) {
  41.   var childList = e.selectSingleNode("//pictures").childNodes;
  42.   var maxHeight = 0;
  43.   for (i=0;i<childList.length;i++) {
  44.     if (parseInt(childList[i].getAttribute("thumbheight")) > maxHeight) {
  45.       maxHeight = parseInt(childList[i].getAttribute("thumbheight"));
  46.     }
  47.   }
  48.   gMaxHeight = maxHeight;
  49.   }
  50.   
  51. ]]></xsl:script>
  52.  
  53. <!--
  54.     the template block describes this template.
  55.     this info is used by FP when building the photo gallery dialog
  56. -->
  57. <template>
  58.     <title>
  59.     Horizontal Layout</title>
  60.     <description>- Thumbnails of your images are created automatically.
  61. - Thumbnail images display in multiple rows.
  62. - Descriptive text is placed below each image.        
  63.     </description>
  64.     <defaults imgPerRow="7" thumbWidth="100" />
  65.     <dependent-files />
  66. </template>
  67.  
  68. <xsl:template><xsl:copy><xsl:apply-templates select="@* | * | comment() | pi() | text()"/></xsl:copy></xsl:template>
  69.  
  70. <xsl:template match="/">
  71.     <xsl:eval>
  72.         setMaxHeight(this)
  73.     </xsl:eval>
  74.     <xsl:apply-templates select="xml"/>
  75. </xsl:template>
  76.  
  77. <!-- this template has identical Preview and Real output -->
  78. <xsl:template match="xml[@output != 'subpage']">
  79. <html>
  80. <head>
  81.     <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  82.     <title><xsl:value-of select="//options/@pageName"/></title>
  83. </head>
  84. <body>
  85. <xsl:if expr="notPreviewOutput(this)">
  86. <picture file-href="real_p.htm" /> 
  87. <picture file-href="real_x.htm" />
  88. </xsl:if>
  89. <table border="0" cellspacing="0" cellpadding="0">
  90.     <xsl:attribute name="id">fpGalleryTable_<xsl:eval>rnd</xsl:eval></xsl:attribute>
  91.   <tr>
  92.   <xsl:for-each select="//pictures">
  93.     <xsl:apply-templates />
  94.   </xsl:for-each>
  95.   </tr>
  96.   <tr>
  97.     <td>
  98.             <xsl:attribute name="colspan"><xsl:eval>gnumPerRow</xsl:eval></xsl:attribute>
  99.         </td>
  100.   </tr>
  101. </table>
  102. </body>
  103. </html>
  104. </xsl:template>
  105.  
  106.  
  107. <!-- this is the output we generate for each sub page of the gallery -->
  108. <xsl:template match="xml[@output='subpage']">
  109. <html>
  110. <head>
  111. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  112. <title><xsl:value-of select="//picture/caption"/></title>
  113. </head>
  114. <body>
  115. <div align="center">
  116.     <table width="100%" align="center">
  117.         <tr>
  118.             <td width="100%" align="center" colspan="3">
  119.             <img hspace="10" border="0">
  120.             <xsl:attribute name="width"><xsl:value-of select="//picture/@filewidth"/></xsl:attribute>
  121.             <xsl:attribute name="height"><xsl:value-of select="//picture/@fileheight"/></xsl:attribute>
  122.             <xsl:attribute name="src"><xsl:value-of select="//picture/@file-href"/></xsl:attribute>
  123.             <xsl:attribute name="title"><xsl:value-of select="//picture/caption"/></xsl:attribute>
  124.             </img>
  125.             </td>
  126.         </tr>
  127.         <tr><td colspan="3"><xsl:apply-templates select="//picture/caption"/></td></tr>
  128.         <tr><td colspan="3"><xsl:apply-templates select="//picture/desc"/></td></tr>
  129.         <tr>
  130.             <td><a><xsl:attribute name="href"><xsl:value-of select="//picture/@prevImgPath"/></xsl:attribute>Previous Image</a></td>
  131.             <td><a><xsl:attribute name="href"><xsl:value-of select="//picture/@galleryPath"/></xsl:attribute>Back To Gallery</a></td>
  132.             <td><a><xsl:attribute name="href"><xsl:value-of select="//picture/@nextImgPath"/></xsl:attribute>Next Image</a></td>
  133.         </tr>
  134.     </table>
  135. </div>
  136. </body>
  137. </html>
  138. </xsl:template>
  139.  
  140.     
  141. <xsl:template match="picture">
  142.     <xsl:if expr="breakRow(this)">
  143.     <tr><td height="10"></td>
  144.     </tr>
  145.     <tr/>
  146.     </xsl:if>
  147.  
  148.     <xsl:choose>
  149.     <xsl:when expr="rowEnd(this)">
  150.     <xsl:if expr="notPreviewOutput(this)">
  151.         <script language="JavaScript1.1">
  152.             <xsl:eval no-entities='t'>NBSP()</xsl:eval>
  153.         </script>
  154.     </xsl:if>
  155.     <td valign="top">
  156.     <xsl:attribute name="style">border-left-style: solid; border-left-width: 1px; border-left-color:black;
  157.         border-right-style: solid; border-right-width: 1px; border-right-color:black</xsl:attribute>
  158.       <table border="0" cellpadding="2" cellspacing="0" align="center" width="120">
  159.         <tr>
  160.             <td valign="top" align="center">
  161.             <xsl:attribute name="height"><xsl:eval>gMaxHeight + 20</xsl:eval></xsl:attribute>
  162.             <a>
  163.             <xsl:attribute name="href"><xsl:value-of select="@file-href"/></xsl:attribute>
  164.             <img border="0" vspace="5" hspace="12">
  165.             <xsl:attribute name="src"><xsl:value-of select="@thumb-href"/></xsl:attribute>
  166.                         <xsl:attribute name="width"><xsl:value-of select="@thumbwidth"/></xsl:attribute>           
  167.             <xsl:attribute name="height"><xsl:value-of select="@thumbheight"/></xsl:attribute>
  168.             <xsl:attribute name="title"><xsl:value-of select="@caption"/></xsl:attribute>            
  169.             </img></a>
  170.             </td>
  171.         </tr>
  172.         <tr>
  173.             <td valign="top">
  174.             <xsl:apply-templates select="caption"/>
  175.             <xsl:value-of select="@desc"/>
  176.                         <xsl:apply-templates select="desc"/>
  177.             </td>
  178.         </tr>
  179.       </table>
  180.     </td>
  181.     <xsl:if expr="notPreviewOutput(this)">
  182.         <script language="JavaScript1.1">
  183.             <xsl:eval no-entities='t'>NBSP()</xsl:eval>
  184.         </script>
  185.     </xsl:if>
  186.     </xsl:when>
  187.     <xsl:otherwise>
  188.     <xsl:if expr="notPreviewOutput(this)">
  189.         <script language="JavaScript1.1">
  190.             <xsl:eval no-entities='t'>NBSP()</xsl:eval>
  191.         </script>
  192.     </xsl:if>
  193.     <td valign="top">
  194.     <xsl:attribute name="style">border-left-style: solid; border-left-width: 1px; border-left-color:black</xsl:attribute>
  195.       <table border="0" cellpadding="2" cellspacing="0" align="center" width="120">
  196.         <tr>
  197.             <td valign="top" align="center">
  198.             <xsl:attribute name="height"><xsl:eval>gMaxHeight + 20</xsl:eval></xsl:attribute>
  199.             <a>
  200.             <xsl:attribute name="href"><xsl:value-of select="@file-href"/></xsl:attribute>
  201.             <img border="0" vspace="5" hspace="12">
  202.             <xsl:attribute name="src"><xsl:value-of select="@thumb-href"/></xsl:attribute>
  203.                         <xsl:attribute name="width"><xsl:value-of select="@thumbwidth"/></xsl:attribute>           
  204.             <xsl:attribute name="height"><xsl:value-of select="@thumbheight"/></xsl:attribute>
  205.             <xsl:attribute name="title"><xsl:value-of select="@caption"/></xsl:attribute>            
  206.             </img></a>
  207.             </td>
  208.         </tr>
  209.         <tr>
  210.             <td valign="top">
  211.             <xsl:apply-templates select="caption"/>
  212.             <xsl:value-of select="@desc"/>
  213.                     <xsl:apply-templates select="desc"/>
  214.             </td>
  215.         </tr>
  216.       </table>
  217.     </td>        
  218.     </xsl:otherwise>
  219.     </xsl:choose>
  220. </xsl:template>
  221.  
  222.  
  223. <xsl:template match="caption | desc"><xsl:apply-templates /></xsl:template>
  224.  
  225. </xsl:stylesheet>