|
Subject: Re: [xsl] Slow XSLT From: Cleyton Jordan <cleytonjordan@xxxxxxxxxxx> Date: Thu, 13 Mar 2008 01:06:25 +0000 (GMT) |
Hi David,
Thanks for your code example. I will be able to test
it only tomorrow when I get to work.
The only problem I have with your first apply
templates is that the xml I showed you is just an
extract containing only the Rows section.
However, I also have the Columns section that uses the
same Measure elements for its output. It is a quite
complex grid I am building and it was very slow.
Manfred showed me a technique to improve the speed of
the Columns transformation. But maybe for the Rows you
are right, I do not need to use the same technique.
However, I have to make sure this code does not
conflict with the other parts of my xslt.
<xsl:template match="Report">
<html>
<head><title>report</title></head>
<body>
<table>
<xsl:apply-templates/>
</table>
</body>
</html>
</xsl:template>
I will be able to post a better formed xml tomorrow.
This I am writing at the top of my head.
<Report xmlns="">
<Measures>
<Measure idx="1" heading="Total Pages" />
<Measure idx="2" heading="Cost" />
</Measures>
<Columns>
<ColGrp>
<ColGrp>
<Col />
<ColGrp>
<ColGrp>
</Columns>
<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>
--- David Carlisle <davidc@xxxxxxxxx> wrote:
>
> 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> </td>
> <td> </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> </td>
> <td> </td>
> </tr>
> <tr>
> <td> </td>
> <td> </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.
>
________________________________________________________________________
>
>
___________________________________________________________
Rise to the challenge for Sport Relief with Yahoo! For Good
http://uk.promotions.yahoo.com/forgood/
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Slow XSLT, David Carlisle | Thread | RE: [xsl] Slow XSLT, Michael Kay |
| Re: [xsl] Slow XSLT, David Carlisle | Date | [xsl] No of Times Named Template ca, Senthilkumaravelan K |
| Month |