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

RE: Slow XSLT

Subject: RE: Slow XSLT
From: Cleyton Jordan <cleytonjordan@xxxxxxxxxxx>
Date: Thu, 13 Mar 2008 00:14:07 +0000 (GMT)
RE:  Slow XSLT
Sorry, I will try again,

For each Row in my xml I need to output a <tr>. So I
apply templates. 

<xsl:variable name=set" select="Report/Rows//Row" />
.....
 <xsl:apply-templates select="$set"/>
.....

<xsl:template name="Row">
......
<tr>
 <xsl:param name="set"/>
  <xsl:apply-templates select="$set[postion()]/*"/>
</tr>
<xsl:template>

<xsl:template name="Cell">
  When test Msr
   for each Msr
   <td> 
     <xsl:value-of select="@val" />
   </td>
  Otherwise
   For each Measure
    <td>&nbsp;</td>
<xsl:template>


In the Row template I apply templates again but this
time I use the /* to get the child elements (Cell).
However, if I do this - <xsl:apply-templates
select="$set/*"/> - I will apply templates to all the
Cell elements. So I will have only one <tr> with lots
of <td>s. Something like that:

<tr>
<td></td> 
<td></td> 
<td></td> 
<td></td> 
<td></td> 
<td></td> 
<td></td> 
<td></td> 
</tr>

However, the output I need according to my xml below
is this:

<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> 

XML

<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 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>









--- Michael Kay <mike@xxxxxxxxxxxx> wrote:

> > 
> > It is like if I was using [1], [2] to get the
> current Row 
> > (Row[1], Row[2]) but the '.' does not work with
> the node set $set
> > 
> > Is that clearer?
> 
> No, I'm sorry, it isn't. Either you want to process
> the current row, or you
> want to process the rows in $set - you keep talking
> about the "current" Row,
> and then saying you don't want the current Row, you
> want a row in $set. You
> can do either, but you seem to be confused about
> which you want.
> 
> Michael Kay
> http://www.saxonica.com/
> 
> 



      __________________________________________________________
Sent from Yahoo! Mail.
The World's Favourite Email http://uk.docs.yahoo.com/nowyoucan.html

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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

Buy Stylus Studio Now

Cast Your Vote

We need your help – Vote for DataDirect XML Products!

  • Best SOA or XML site

Winners and finalists announced at SOA World Conference in November.

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-2007 All Rights Reserved.