xsl-list
[Top] [All Lists]

Re: [xsl] Help with using position()

2012-01-01 07:26:34
Still experimenting with this but for XSL documents where my node is already 
set to Calculation using this works.

<xsl:number value="position()"/>

And I think I have a solution for when my node is set to Chunks instead and 
that is the following.

<xsl:number count="DisplayCalculation" level="any" 
from="/FMPReport/File[1]/BaseTableCatalog[1]"/>

But by adding this it then takes the process from 11 seconds to 84 seconds.

I feel like I am being very inefficient here with this.

Thanks for any ideas on where to look.

Vince

On Jan 1, 2012, at 4:45 AM, Vincenzo Menanno wrote:

Martin,

I think I spoke too soon. Adding <xsl:number level="any" 
count="Calculation"/> is a performance killer.

Usually these files are very large and they could have Calculation nodes in 
other parts of the document what I was hoping for is to have a way to only 
count the unique instances of Calculation within a certain catalog.

I tried this:

<xsl:number level="any" from="BaseTableCatalog" count="Calculation"/>

But the first item comes in with a value of 1 and all others come in with a 
value of 0

I am using different XSLs to parse different sections. So I was hoping that I 
would be able to use the same logic for both Calculation and Chunks to keep 
them in sync. Its ok that the numbering sequence starts over in each catalog.

And hoping that the performance won't be affected to much.

... see email thread for example.

On Jan 1, 2012, at 2:52 AM, Martin Honnen wrote:

Vincenzo Menanno wrote:
A few more questions using the example below.

I have 1 xsl that gets me all the Calculations and using postion() function 
I am able to get the position number of the calculation.

<xsl:value-of select="position()"/>

All I want is a unique number or sequence number of each calculation. So is 
position() the most effective way to do this?

position() works as long as your for-each or apply-templates processes only 
the nodes you are interested in to number.
In the more general case (for instance when you process all child elements 
but are only interested in numbering "foo" elements) you would use 
xsl:number (http://www.w3.org/TR/xslt#number) as in
<xsl:number count="foo"/>


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