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

Re: Breaking up is hard to do.

Subject: Re: Breaking up is hard to do.
From: "Nikolai Grigoriev" <grig@xxxxxxx>
Date: Mon, 21 Feb 2000 11:24:59 +0300
xsl suppress rows
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


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.