[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|