[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: Wed, 12 Mar 2008 22:37:00 +0000 (GMT)
RE:  Slow XSLT
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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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

Buy Stylus Studio Now

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