[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: Breaking up is hard to do.


Subject: Re: Breaking up is hard to do.
From: "Steve Muench" <smuench@xxxxxxxxxxxxx>
Date: Sun, 20 Feb 2000 17:19:14 -0800

Nikolai,

| >  <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:

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.

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!

XSLT allows lots of different ways to approach the solution. 
That's part of the fun of monitoring this list!
__________________________________________________________
Steve Muench, Lead XML Evangelist / Consulting Product Mgr
Oracle Corp, Business Components for Java Development Team
http://technet.oracle.com/tech/xml
----- Original Message ----- 
From: "Nikolai Grigoriev" <grig@xxxxxxx>
To: "XSL List" <xsl-list@xxxxxxxxxxxxxxxx>
Sent: Sunday, February 20, 2000 2:20 AM
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



Current Thread
Keywords