RE: [xsl] Chunking xml into single-topic docs

Subject: RE: [xsl] Chunking xml into single-topic docs
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 25 Feb 2005 23:06:29 -0000
If your logic is as simple as

<xsl:for-each select="chapter">
  <xsl:result-document href="chap{position()}">

then I would definitely use position() - it's easy to express and easy for
the processor to calculate.

Using things like <xsl:number/> or count(preceding-sibling::*) is sometimes
necessary but it has a serious risk of being O(n^2) in performance
(depending of course on the optimizer).

Michael Kay 

> -----Original Message-----
> From: Kessler, Marcy [mailto:marcy.kessler@xxxxxx] 
> Sent: 25 February 2005 21:41
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] Chunking xml into single-topic docs
> To All:
> Thank you for the help.  To clarify, I actually want to create unique
> file names by attaching a number to each file created.  Is the best
> method for doing this <xsl:count> as both David and Jay suggested?
> Michael, would your suggestion of using something like
> href="chap{position()}" be a better way to go.  If so, why?
> (being new to the list, I hope that applying to the list from 
> the digest
> follows my original thread correctly - apologies for being a newbie on
> all fronts ;) )
> Thanks again!
> Regards,
> Marcy

Current Thread