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

RE: alternating node type in a loop

Subject: RE: alternating node type in a loop
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Sat, 13 Jul 2002 03:12:22 -0700 (PDT)
 RE: alternating node type in a loop
--- "McNally, David" <David dot McNally at moodys dot com> wrote:

> 
> If I understand you correctly, this should do it:
> 
> <xsl:apply-templates select="article">
> <xsl:sort
>
select="concat(count(preceding-sibling::article[@type=current()/@type]),'::'
> ,@type)"/>
> </xsl:apply-templates>
> 
> which will process the first article of type 1, then the first of
> type
> 2
> (and potentially the first of type 3), then move on to the second of
> each
> type, etc.

Hi David, 

I want to congratulate you for this ellegant solution.

Just a minor remark: in case there are many different values for the
"type" attribute, it would be necessary to split the xsl:sort
instruction into two, each specifying data-type="number".

This is necessary, because when sorted as text "10" comes before "2".


> 
> Note that an old version of MSXML that is in my copy of XMLSpy didn't
> process this correctly, but Saxon 6.5.2 did.

Actually, the buggy processor is MSXML4, MSXML3 produces the correct
result.




=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL

__________________________________________________
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.