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

Re: Switching Between Two Column Mode and One Column M

Subject: Re: Switching Between Two Column Mode and One Column Mode - Peek Ahead?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 23 May 2005 16:36:49 +0100
colspan twocolumn
> You got it exactly in the last form, let me include one special case:

yes I think that's the same as the example I gave (but with 2 rather
than 4 being long)


<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">



<xsl:output indent="yes"/>

<xsl:template match="x">
<table>
<xsl:apply-templates select="item[1]"/>
</table>
</xsl:template>


<xsl:template match="item">
<xsl:choose>
<xsl:when test="(string-length(.) &gt; 4  or string-length(following-sibling::item[1])&gt; 4)">
<tr>
<td colspan="2">
<xsl:value-of select="."/>
</td>
</tr>
<xsl:apply-templates select="following-sibling::item[1]"/>
</xsl:when>
<xsl:otherwise>
<tr>
<td>
<xsl:value-of select="."/>
</td>
<td>
<xsl:value-of select="following-sibling::item[1]"/>
</td>
</tr>
<xsl:apply-templates select="following-sibling::item[2]"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>


</xsl:stylesheet>





<x>
<item>1</item>
<item>2</item>
<item>333333</item>
<item>4</item>
<item>5</item>
<item>6</item>
</x>
<?xml version="1.0" encoding="utf-8"?>
<table>
   <tr>
      <td>1</td>
      <td>2</td>
   </tr>
   <tr>
      <td colspan="2">333333</td>
   </tr>
   <tr>
      <td>4</td>
      <td>5</td>
   </tr>
   <tr>
      <td>6</td>
      <td/>
   </tr>
</table>





<x>
<item>1</item>
<item>2 2 2 2 </item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
</x>
<table>
   <tr>
      <td colspan="2">1</td>
   </tr>
   <tr>
      <td colspan="2">2 2 2 2 </td>
   </tr>
   <tr>
      <td>3</td>
      <td>4</td>
   </tr>
   <tr>
      <td>5</td>
      <td>6</td>
   </tr>
</table>

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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.