Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xsl] Splitting files 5 at a time

From: Wendell Piez <wapiez@---------------->
To:
Date: 4/2/2008 7:09:00 PM
Andy,



At 02:49 PM 4/2/2008, you wrote:
> From: David Carlisle [mailto:davidc@xxxxxxxxx]
> Sent: 02 April, 2008 14:37
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] Splitting files 5 at a time
>
>
>
>    [count() mod 5 = 0]
>
> [position() mod 5 = 1]

I thought I understood his problem to be that he wanted the
first five customers in one file, then the next five customers
in the next, etc.  If he just did what you suggested wouldn't
he just grab every 1 in 5 customers out of the group of five
customers?

Customer  1 => position() mod 5 = 1
Customer  2 => position() mod 5 = 2
Customer  3 => position() mod 5 = 3
Customer  4 => position() mod 5 = 4
Customer  5 => position() mod 5 = 0

Customer  6 => position() mod 5 = 1
Customer  7 => position() mod 5 = 2
Customer  8 => position() mod 5 = 3
Customer  9 => position() mod 5 = 4
Customer 10 => position() mod 5 = 0

So if I understood your solution, he would create the first file
with Customer 1, 6, 11, 16, 21 and not Customer 1, 2, 3, 4, 5.
Is that correct?

Not quite, although you are correct as to which nodes would be 
selected by David's XPath.



A more complete explanation would offer that the for-each selects nos 
1, 6, 11 etc. and that a file should be generated for each of these, 
to contain the customer selected plus its four immediately following 
customer siblings.



So the OP would need to select customer[position() mod 5 = 1] to 
group the customers into their files, and then include the results of 
processing (.|following-sibling[position() < 5]) into each file generated.



David was just enjoying shorthand, as he frequently does, and perhaps 
trusting that the OP would fill in the rest.



Cheers,
Wendell


======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


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