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: Breaking up is hard to do.


Nikolai,

This is a very elegant solution to the problem. The downside, however, it
requires significantly more processing time using Xalan (about 30% according
to my tests) than does the procedural method discussed earlier.

Do folks on this list have any general guidelines regarding XSLT
performance? 

Regards,
-John

-----Original Message-----
From: Nikolai Grigoriev [mailto:grig@iitp.ru]
Sent: Sunday, February 20, 2000 5:21 AM
To: XSL List
Subject: Re: Breaking up is hard to do.


Joel Hughes writes:

>>     I am unable to generate a </tr><tr> in my output.

Steve Muench replies:

>Here's a simple way to do it that works like
>your brain might be thinking. It depends
>on using the:
>
>  <xsl:text disable-output-escaping="yes">

It's a potentially dangerous technique: you can produce a malformed
document as well. I dare suggest the following instead:

<!-- Disable default processing of fields that don't start the row -->
<xsl:template match="field[position() mod $max  != 1]"/>

<!-- Processing of fields that start the row. Create a row -->
<!-- and enumerate fields in the row, than switch the mode -->
<xsl:template match="field[position() mod $max = 1]">
   <tr>
      <xsl:for-each select="self::field |
                             following-sibling::field[position() < $max]>
         <xsl:apply-templates mode="create-cell"/>
      </xsl:for-each>
   </tr>
</xsl:template>

<!-- Place all real processing for field cell here -->
<xsl:template match="field" mode="create-cell">
   <td><xsl:apply-templates/></td>
</xsl:template>

Regards,
Nikolai



 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]