home *** CD-ROM | disk | FTP | other *** search
/ PC World 2003 December / PCWorld_2003-12_cd.bin / Software / komercni / alc / ep2sr51csy.msi / Ep.CAB / repx8 < prev    next >
Extensible Markup Language  |  2002-07-20  |  2KB  |  84 lines

  1. <?xml version='1.0' encoding="windows-1250" ?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
  3.  
  4. <xsl:template match="/">
  5.  
  6. <xsl:eval>Init(this)</xsl:eval>
  7.  
  8. <table class="Frame" border="1" cellpadding="0" cellspacing="0" width="100%">
  9.  
  10. <thead>
  11.     <tr>
  12.         <td class="head">P°edm∞t</td>
  13.         <td class="head">Vlastnosti</td>
  14.     </tr>
  15. </thead>
  16.  
  17. <tbody>
  18. <xsl:for-each select="//node">
  19.     <xsl:if expr="TestNode(this)">
  20.         <tr>
  21.             <td class="Frame"><xsl:value-of select="name"/></td>
  22.             <td class="Frame">
  23.             <xsl:for-each select="proplist/prop" order-by="kind">
  24.                 <xsl:if expr="TestProp(this)">
  25.                     <xsl:apply-templates select="."/>
  26.                 </xsl:if>
  27.             </xsl:for-each>
  28.             </td>
  29.         </tr>
  30.     </xsl:if>
  31. </xsl:for-each>
  32. </tbody>
  33. </table>
  34.  
  35. </xsl:template>
  36.  
  37. <xsl:template match="prop">
  38. <b><xsl:value-of select="kind"/>:</b> <xsl:value-of select="value"/><br/>
  39. </xsl:template>
  40.  
  41.  
  42. <xsl:script><![CDATA[
  43. var g_Kind;
  44. var g_PropDict;
  45.  
  46. function MakePatternString(s) {
  47.     var st;
  48.     st=s;
  49.     st=st.replace("&","&");
  50.     st=st.replace("\"",""");
  51.     st=st.replace("<",">");
  52.     st=st.replace(">","<");
  53.     st=st.replace("'","\\'");
  54.     return st;
  55. }
  56.  
  57. function Init(e) {
  58.     var i;
  59.     p=e.selectSingleNode("/report/kind");
  60.     g_Kind=p.text;
  61.     
  62.     g_PropDict=new ActiveXObject("Scripting.Dictionary");
  63.     p=e.selectNodes("/report/columns/kind");
  64.     for ( i=0; i<p.length; i++ ) {
  65.         g_PropDict.Add(p[i].text,"");
  66.     }
  67. }
  68.  
  69. function TestNode(e) {
  70.     q="proplist/prop[kind='Druh' and value='" + MakePatternString(g_Kind) + "']";
  71.     p=e.selectNodes(q);
  72.     return p.length>0;
  73. }
  74.  
  75. function TestProp(e) {
  76.     p=e.selectSingleNode("kind");
  77.     if ( !p )
  78.         return false;
  79.     return g_PropDict.Exists(p.text);
  80. }
  81.  
  82. ]]></xsl:script>
  83.  
  84. </xsl:stylesheet>