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

Re: Turning off 'well-formedness'

Subject: Re: Turning off 'well-formedness'
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 09 Jan 2002 18:25:59 -0500
Re:  Turning off 'well-formedness'
Richard,

The classic solution to your problem would pick up every third <Record> and group its next two siblings with it, along the lines of:

<xsl:template match="Record">
  <xsl:if test="(count(preceding-sibling::Record) mod 3) = 1">
  <!-- works on first, fourth, seventh Records, etc. -->
    <td>
      <xsl:apply-templates/>
      <br/>
      <xsl:for-each select="following-sibling::Record(position() &lt; 3)">
         <!-- picks up the next two Records -->
         <xsl:apply-templates/>
         <br/>
      </xsl:for-each>
    </td>
  </xsl:if>
</xsl:template>

You say you want a <br> after every entry; but you can see here it's easy enough to put one just before 2nd and 3rd rows, not after each.

Also, you can see how easy it is to parameterize this: just change the number '3' into a parameter to make bigger or smaller groups.

Don't try to 'turn off well-formedness' -- the language is built to work with it, not without it. Whenever you think it's in the way, it's probably because your approach to the problem isn't XSL-ish enough.

Cheers,
Wendell

At 04:20 PM 1/9/02, you wrote:
Folks,

I am trying to create the following marked-up tags using MSXML3 on an IE5.x
browser:

<td>
        data1 <br />
        data2 <br />
        data3 <br />
</td>
<td>
        data4 <br />
        data5 <br />
        data6 <br />
</td>
----------------------------------------------------------
my source file looks like:

<Data>
    <Record>data</Record>
    <Record>data</Record>
    <Record>data</Record>
    <Record>data</Record>
    <Record>data</Record>
    <Record>data</Record>
</Data>
----------------------------------------------------------


======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


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.