Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] Slow XSLT

From: David Carlisle <davidc@--------->
To:
Date: 3/12/2008 10:56:00 PM
> <xsl:apply-templates select="$set[postion()]/*"/>

a numeric filter such as $set[1] is shorthand for the boolean filter
$set[position()=1]
so the above is shorthand fr
<xsl:apply-templates select="$set[postion()=position()]/*"/>
so as the test is always true it is the same as
<xsl:apply-templates select="$set/*"/>


> I need to apply templates to the child of the current
> Row element that is in the $set node set. But the '.'
xslt 1 doesn't have a direct test on node identity you can howerver
> use, for example

select="*[count(.|$set)=count($set)]"

which selects all child elements that are in the set $set.


> This XPATH works though:
> 
> <xsl:apply-templates select="./Cell"/>
 ./ at the start of an xpath is redundent, so this is the same as

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

and selects child Cell elements


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

You'd need to be clearer about what you mean here.
. or current() will get the current context

perhaps 

select="Cell[count(.|$set)=count($set)]"

is what you need but I can't be sure from this description


> I have created a node set of Rows:
> 
> <xsl:variable name=set" select="Report/Rows//Row" /> 

you probably don't want // there which causes a search to arbitrary
depth looking for Row elements, but why do you need this variable 
at all, rather than simply applying templates to the Row elements as
they occur in the source?

It would seem that by 


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



you want to select the children of _this_ Row, but you don't need to do
anything for that, just



<xsl:template name="Row">
<tr>
 <xsl:apply-templates/>
</tr>
<xsl:template>

would work fine wouldn't it?

David

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________


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