!C99Shell v. 1.0 pre-release build #16!

Software: Apache/2.0.54 (Fedora). PHP/5.0.4 

uname -a: Linux mina-info.me 2.6.17-1.2142_FC4smp #1 SMP Tue Jul 11 22:57:02 EDT 2006 i686 

uid=48(apache) gid=48(apache) groups=48(apache)
context=system_u:system_r:httpd_sys_script_t
 

Safe-mode: OFF (not secure)

/usr/lib/4Suite/tests/Xml/Xslt/Borrowed/   drwxr-xr-x
Free 7.85 GB of 27.03 GB (29.05%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     js_20001016.py (4.63 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
#"John E. Simpson" <simpson@polaris.net>

from Xml.Xslt import test_harness

sheet_1 = """<?xml version="1.0"?>
<!--  Including the HTML 4.0 namespace declaration, i.e.
      xmlns="http://www.w3.org/TR/REC-html40", makes the
      usd_equiv element empty. So it's not included below. :) -->
<xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:exsl="http://exslt.org/common"
   exclude-result-prefixes="exsl"
>

<xsl:template match="/">
   <html>
     <head><title>Sorting an RTF</title></head>
     <body>
       <xsl:apply-templates/>
     </body>
   </html>
</xsl:template>

<!-- Template rule for root element <products> -->
<xsl:template match="products">
   <!-- This variable will hold the RTF, including the
        usd_equiv element for each product -->
   <xsl:variable name="prods_with_usd">
     <xsl:apply-templates select="product" mode="calc_usd" />
   </xsl:variable>
   <table border="1">
     <tr>
       <th>Name/Version</th>
       <th>Price / Curr</th>
       <th>Price (USD)</th>
     </tr>
     <!-- Note that the apply-templates doesn't select the
          <product> children, which would be "conventional," but
          the RTF (converted to node-set) created by the above
          variable. -->
     <xsl:apply-templates select="exsl:node-set($prods_with_usd)/*">
       <xsl:sort select="usd_equiv"/>
     </xsl:apply-templates>
   </table>
</xsl:template>

<!-- When the mode is "calc_usd" (as in apply-templates within
      the xsl:variable above which creates the prods_with_usd RTF),
      copy the product node and its attributes, and add a
      <usd_equiv> child for each <product> element -->
<xsl:template match="product" mode="calc_usd">
   <xsl:copy>
     <xsl:copy-of select="@*" />
     <xsl:copy-of select="*" />
     <!-- <xsl:element> can be replaced, if you want, with a simple
          literal result element, i.e. <usd_equiv>. In either case, the
          element so created isn't in the HTML namespace, which is
          apparently why adding the HTML 4.0 namespace declaration
          makes this <usd_equiv> element "disappear." -->
     <xsl:element name="usd_equiv">
       <xsl:choose>
         <xsl:when test="price/@curr='USD'">
           <xsl:value-of select="format-number(price, '#,##0.00')"/>
         </xsl:when>
         <xsl:when test="price/@curr='GBP'">
           <xsl:value-of select="format-number(price * 1.47275, '#,##0.00')"/>
         </xsl:when>
         <xsl:when test="price/@curr='EU'">
           <xsl:value-of select="format-number(price * 0.864379, '#,##0.00')"/>
         </xsl:when>
         <xsl:otherwise>Unknown Currency</xsl:otherwise>
       </xsl:choose>
     </xsl:element>
   </xsl:copy>
</xsl:template>

<!-- When the mode isn't specified, simply create a table row
      for the product in question. -->
<xsl:template match="product">
   <tr>
     <td valign="top"><xsl:value-of select="name"/></td>
     <td align="right">
       <xsl:value-of select="price"/> / <xsl:value-of select="price/@curr"/>
     </td>
     <td align="right"><xsl:value-of select="usd_equiv"/></td>
   </tr>
</xsl:template>

</xsl:stylesheet>"""

source_1 = """<products>
   <product prodID="A1234">
     <name>First prod</name>
     <price curr="USD">29.95</price>
   </product>
   <product prodID="A5678">
     <name>Second prod</name>
     <price curr="GBP">115.95</price>
   </product>
   <product prodID="A9012">
     <name>Third prod</name>
     <price curr="EU">29.95</price>
   </product>
   <product prodID="A9012">
     <name>Fourth prod</name>
     <price curr="USD">50.00</price>
   </product>
</products>"""

expected_1 = """<html>
  <head>
    <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
    <title>Sorting an RTF</title>
  </head>
  <body>
    <table border='1'>
      <tr>
        <th>Name/Version</th>
        <th>Price / Curr</th>
        <th>Price (USD)</th>
      </tr>
      <tr>
        <td valign='top'>Second prod</td>
        <td align='right'>115.95 / GBP</td>
        <td align='right'>170.77</td>
      </tr>
      <tr>
        <td valign='top'>Third prod</td>
        <td align='right'>29.95 / EU</td>
        <td align='right'>25.89</td>
      </tr>
      <tr>
        <td valign='top'>First prod</td>
        <td align='right'>29.95 / USD</td>
        <td align='right'>29.95</td>
      </tr>
      <tr>
        <td valign='top'>Fourth prod</td>
        <td align='right'>50.00 / USD</td>
        <td align='right'>50.00</td>
      </tr>
    </table>
  </body>
</html>"""


def Test(tester):
    source = test_harness.FileInfo(string=source_1)
    sheet = test_harness.FileInfo(string=sheet_1)
    test_harness.XsltTest(tester, source, [sheet], expected_1)
    return


:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 1.0 pre-release build #16 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0036 ]--