[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Slow XSLT

Subject: Re: Slow XSLT
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 13 Mar 2008 00:51:58 GMT
Re:  Slow XSLT
your sample input wasn't well formed but judging by the required result
I think you intended the file below, the xsl produces the requested
result without any use of variables or position().


<Report xmlns="">
  <Measures>
    <Measure idx="1" heading="Total Pages" />
    <Measure idx="2" heading="Cost" />
  </Measures>
  <Rows>
   <RowGrp>
    <Row heading="Name 1">
      <Cell>
        <Msr idx="1" val="10" />
        <Msr idx="2" val="15" />
      </Cell>
      <Cell/>
    </Row>
    <Row heading="Name 2">
      <Cell />
      <Cell>
        <Msr idx="1" val="45" />
        <Msr idx="2" val="34" />
	</Cell>
      <Cell>
        <Msr idx="1" val="123" />
        <Msr idx="2" val="19" />
	</Cell>
    </Row>
   </RowGrp>
  </Rows>
</Report>



<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  
<xsl:strip-space elements="*"/>

<xsl:template match="Report">
  <html>
    <head><title>report</title></head>
    <body>
      <table>
	<xsl:apply-templates/>
      </table>
    </body>
  </html>
</xsl:template>

<xsl:template match="Measures">
  <tr>
    <xsl:apply-templates/>
    <xsl:apply-templates/>
  </tr>
</xsl:template>

<xsl:template match="Row">
  <tr>
    <xsl:apply-templates/>
  </tr>
</xsl:template>

<xsl:template match="Measure">
  <th><xsl:value-of select="@heading"/></th>
</xsl:template>

<xsl:template match="Msr">
  <td><xsl:value-of select="@val"/></td>
</xsl:template>
<xsl:template match="Cell[not(*)]">
  <td>&#160;</td>
  <td>&#160;</td>
</xsl:template>




</xsl:stylesheet>



$ saxon rept.xml rept.xsl
<html>
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   
      <title>report</title>
   </head>
   <body>
      <table>
         <tr>
            <th>Total Pages</th>
            <th>Cost</th>
            <th>Total Pages</th>
            <th>Cost</th>
         </tr>
         <tr>
            <td>10</td>
            <td>15</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
         </tr>
         <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>45</td>
            <td>34</td>
            <td>123</td>
            <td>19</td>
         </tr>
      </table>
   </body>
</html>

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.