xsl-list
[Top] [All Lists]

RE: [xsl] Slow XSLT

2008-03-12 15:37:34
Hi,

XSLT 1

Manfred has kindly showed me how to use call template
together with tail recursion to speed up the
transformation of my xslt.

Now I am trying to apply the same pattern to increase
the speed of my Rows transformation but am stuck with
this XPATH:

<xsl:apply-templates select="$set[postion()]/*"/>

I need to apply templates to the child of the current
Row element that is in the $set node set. But the '.'
(dot - context) doest not work with the $set. So I
decided to try position() but to no avail 

This XPATH works though:

<xsl:apply-templates select="./Cell"/>

but doest not use the $set variable.

How do I get the current context using a node set
variable?

This is the template where the problem happens

<xsl:template name="Row">
<tr>
 <xsl:param name="set"/>
 //This xpath works
   <xsl:apply-templates select="./Cell"/>
 //This using the node set doesn't
 <xsl:apply-templates select="$set[postion()]/*"/>
</tr>
<xsl:template>


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

I have created a node set of Rows:

<xsl:variable name=set" select="Report/Rows//Row" /> 

Then I call template passing the node set:

<xsl:call-template name="apply-set">
with paramter $set
</xsl:call-template>

<xsl:template name="apply-set">
 <xsl:param name="set"/>
 <xsl:apply-templates select="$set"/>
<xsl:template>

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

<xsl:template name="Cell">
<td>
  for each Msr
   <xsl:value-of select="@val" />
</td>
<xsl:template>




 


        
        
                
___________________________________________________________ 
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail 
http://uk.messenger.yahoo.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>
--~--

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