Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xsl] Slow XSLT

From: Cleyton Jordan <cleytonjordan@----------->
To:
Date: 3/12/2008 10:37:00 PM
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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent