xsl-list
[Top] [All Lists]

Re: [xsl] Slow XSLT

2008-03-12 18:55:33


<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. 
________________________________________________________________________

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