[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Re: Default attribute value templates
Trevor Nash wrote: > Thanks to Mike Kay and Dimitre Novatchev for their answers addressing > the example given. The bottom line seems to be that using AVTs for > xsl elements which have defaults is a tricky business. > > My example was over simplified: I want all the attributes of xsl:sort > (except "select" which is another problem entirely) not just 'order'. [snip] > Yes, thats the sort of thing I had in mind. The problem is xsl:sort > has four attributes which take AVTs, which makes 16 xsl:whens and 16 > copies of the xsl:apply-templates which could have all sorts of other > stuff like modes, selects, with-params etc. Bad news for maintenance > and testing. If we use Mike's method where it applies this comes down > to 4, but its still uglier than I like. > > I think I will do two passes: the first to generate a stylesheet with > the right xsl:sort in it, then a second to apply it. This lets me > parameterise 'select' as well, and with a change to the way 'x' is > defined allow more than one sort key. In all complicated cases of using xsl:sort I'd strongly recommend to use the generic sort() template (see http://www.vbxml.com/downloads/default.asp?id=v2001611171627 ) It is not dependent on and limited by any particular way of defining or comparing the sort keys -- because this is done in a caller-supplied "compare"-template. The benefits of using a generic sort template are: - conceptual simplicity. - maximum reusability. - no limitations. - less error-prone. - less time consuming to program. - more efficient than a multi-pass algorithm. Cheers, Dimitre Novatchev. __________________________________________________ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.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
|