[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Breaking up is hard to do.
Steve Muench wrote: >I'm not sure what you mean by producing a malformed document. >The result of my example is not ill-formed... > >If you know what tags you need then the exact purpose of >disable-output-escaping is to let you responsibly put them >where you need them. XSLT is primarily meant as a language to transform XML into another XML. By standard XSLT techniques, it is simply impossible to produce a non-well-formed output; and output-escaping techniques can, in principle, be used for such a scope. It's more or less like manipulating processor registers directly from a C code, or permitting pointers in Java ;-). Also, your solution seems to be less expandable: suppose you decide to add different bgcolor attributes to rows depending on their contents, or to suppress a row if all its cells are empty... You can hardly place any XSLT operators inside CDATA section. Anyhow, I hope people will agree there that breaking is not that hard to do in XSLT ;-) >My solution requires a single pass over all the nodes and >does not depend on walking lots of different axes or >on a potentially very, very deep recursion loop. >Think about the problem if the list of elements is 200,000 long! I don't really see any problem: the stack depth required for my solution is $max. I hope no one will group elements by batches of 200,000. I didn't care about optimization; if you are concerned about template calling overhead, here's the rewording of the same thing that does the grouping in a single template - two nested loops as in C/Perl. <xsl:template match="data"> <table> <xsl:for-each select="field[position() mod $max = 1]" > <tr> <xsl:for-each select="self::field | following-sibling::field[position() < $max]> <td><xsl:apply-templates/></td> </xsl:for-each> </tr> </xsl:for-each> </table> </xsl:template> Regards, Nikolai 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
|