This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: unions, for-each, document order



Ok, after reading my own message on the list, I was like, duh, I can just sort the for-each loop by the level attribute, and this will preserve the sort order of the original document (or I can do second level sorting). Gee, this seems to solve the problem just fine. I guess the threat of having 1000's of people read your silly post really gets the gears movin'. Now to find out how to peek at the next node which is about to be processed.

-Steve

Steve Morrison wrote:
> 
> So, I have a set of nodes each called <cat>. The <cat> tag has an attribute called level, which is either 0 or 1. The <cat>s come in alphabetical order, and ones with level="1" or level="0" can occur at any point. I need to process these in such a way that it applies a template to the level="1"'s first, then the level="0"'s. I then do another round of suppression/selection based on some other attributes.
> 
> This would do exactly what I want:
> <xsl:for-each select="cat[@level = 1] | cat[@level = 0]">
>   <xsl:if test="sometest based on parent nodes">
>     <!-- create html -->
>   </xsl:if>
> </xsl:for-each>
> except, the for-each and apply-templates goes in document order, as opposed to copy-of, which applies the union in the order I specify in the select! Is there another way around this? I tried using two different for-each loops, but, then that messes up my inner <xsl:if> test.
> 
> Thanks,
> -Steve
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]