xsl-list
[Top] [All Lists]

RE: [xsl] Slow XSLT

2008-03-12 20:14:35
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(_at_)saxonica(_dot_)com> 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/



--~------------------------------------------------------------------
XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to:
http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>