[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Help with using position()

Subject: Re: Help with using position()
From: Vincenzo Menanno <enzo13@xxxxxxx>
Date: Sun, 01 Jan 2012 05:26:17 -0800
Re:  Help with using position()
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"/>

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