Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to get Balanced 2 Column Table

Status
Not open for further replies.

Karl Blessing

Programmer
Feb 25, 2000
2,936
US
I'm converting a static HTML Table as seen here

(expand the western region for exact one)

To an XML/XSL solution, But heres the problem while I got a single column no problem as you can see here

Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="support.xsl"?>

<supportgroups>
.....
	<city>
		<name>CityOne</name>
		<region>Western</region>
		<supportgroup>
			<title>[Title]</title>
			<date>[date]</date>
			<time>[time]</time>
			<location>[location]</location>
			<notes>[notes]</notes>
			<facilitator>
				<name>PersonOne</name>
				<phone>PhoneOne</phone>
			</facilitator>
			<facilitator>
				<name>PersonTwo</name>
				<phone>PhoneTwo</phone>
			</facilitator>
		</supportgroup>	
        </city>
        <city>
              <name>City Two</name>
.... and so on

and the XSL sheet here

Code:
<?xml version="1.0" encoding="ISO_8859-1" ?>
<xsl:stylesheet
xmlns:xsl="[URL unfurl="true"]http://www.w3.org/1999/XSL/Transform"[/URL]
version="1.0">

<xsl:template match="/">
			<xsl:apply-templates select="supportgroups" />
</xsl:template>

<xsl:template match="supportgroups">
	<html>
		<body>
	<table border="0" width="100%" align="center">
		<tr valign="top">
			<td align="center">
				<xsl:apply-templates select="city" />		
   			</td>
  		</tr>
  	</table>
  </body>
 </html>
</xsl:template>

<xsl:template match="city">
<table style="border:0;cellpadding:2;width:500px;cellspacing:0;">
	<tr>
		<td>									
			<div style="border:1px solid #000000; padding:0px; background:#F7F6D6;">
				<table style="border:0;cellspacing:0;cellpadding:2;width:100%;background:#6E4576; color: #FFFFFF; ">
					<tr>
						<td>
							<xsl:value-of select="./name" />
						</td>
					</tr>
				</table>
				<p>
					<ul>
						<xsl:apply-templates select="supportgroup" />
					</ul>
				</p>
			</div>
		</td>
	</tr>
</table>
</xsl:template>

<xsl:template match="supportgroup">
	<li><b>
		<xsl:value-of select="./title"/>
		</b><br/>
		<xsl:value-of select="./date"/> @ <xsl:value-of select="./time"/><br/>
		<xsl:value-of select="./location"/> -- <xsl:value-of select="../name"/><br/>
		<xsl:if test="./notes !=''">
			<i><b><xsl:value-of select="./notes"/></b></i><br/>
		</xsl:if>
		Facilitator : 
		<xsl:apply-templates select="facilitator" />
	</li>
</xsl:template>

<xsl:template match="facilitator">
	<xsl:value-of select="./name" />, <xsl:value-of select="./phone" /><br />
</xsl:template>

</xsl:stylesheet>


How can I get the table to auto-balanced, based on the number of support groups on each sides of the table much like how I statically did currently on the alzheimer's website.

Karl Blessing
PHP/MySQL Developer
Envynews.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top