Jump to content

Half Static / Half XML table rows


John Smart

Recommended Posts

Hi all,I am using xml/xsl to pull in links to training solutions in a table list. There are 5 columns, the first two are static text, and the last 3 each pull in one element from my xml records (training title, delivery method and country). What i'd like to do is have each training on a seperate row within the overall table row. So there would be 3 mini row's within each main table row.Is this possible? I've encountered issues, and been thinking of other ways round it, but thought I'd check here first. Below is my XSL, and a sample entry from my XML.XML Sample

<training_solution>		<region>UK</region>		<comm_motor_level>Initial</comm_motor_level>		<skillset>Business Knowledge</skillset>		<subskillset>General Insurance Principles</subskillset>		<title>Insurance Principles</title>		<objectives/>		<delivery_method>LMS</delivery_method>		<glf_url>http://www.ALinkSomewhere.com</glf_url>		<comments/>	</training_solution>

XSL

<table class="glftable">	<tr align="center" style="color: #f6f5f1;" bgcolor="#89c1c5">		<td width="160px">Sub Skillset</td>		<td width="220px">Indicator</td>		<td width="220px">Title</td>		<td width="50px">Delivery Method</td>		<td width="50px">Region</td>	</tr>	<tr class="glftablerow">		<td width="200px">			<b>General Insurance Principles</b>			<br />			<ul>				<li>Utmost good faith</li>				<li>Insurable interest</li>				<li>Proximate cause</li>				<li>Indemnity</li>				<li>Subrogation</li>				<li>Contribution</li>			</ul>		</td>		<td width="220px">Can explain the core insurance principles</td>		<td width="220px">			<xsl:for-each select="training_solutions/training_solution[region='UK'][comm_motor_level='Primary'][skillset='Business Knowledge'][subskillset='General Insurance Principles']">			<a href="{glf_url}"><xsl:value-of select="title"/></a>			<br /><br />			</xsl:for-each>		</td>		<td width="40px">			<xsl:for-each select="training_solutions/training_solution[region='UK'][comm_motor_level='Primary'][skillset='Business Knowledge'][subskillset='General Insurance Principles']">				<xsl:value-of select="delivery_method"/>				<br /><br />			</xsl:for-each>		</td>		<td width="40px">			<xsl:for-each select="training_solutions/training_solution[region='UK'][comm_motor_level='Primary'][skillset='Business Knowledge'][subskillset='General Insurance Principles']">				<xsl:value-of select="region"/>				<br /><br />			</xsl:for-each>		</td>	</tr></table></xsl:template></xsl:stylesheet>

So as you can see in the XSL - there is some text in the first 2 columns, then the last 3 each use value select to grab any of the training applicable. I've used breaks for now to leave a gap between each training that appears, but I'd much prefer it to appear in seperate 'sub-rows' - also because if the title is too long, it throws out the alignment of the last two columns.Any help would be so appreciated.Thanks,John

Link to comment
Share on other sites

I have two suggestions1) Put the last 3 columns in their own table ( that is a table nested within the column ), that table having 3 rows.2) Count the maximum number of "sub-rows" and set the rowspan of the first two columns to the maximum number of sub-rows.

Hi all,I am using xml/xsl to pull in links to training solutions in a table list. There are 5 columns, the first two are static text, and the last 3 each pull in one element from my xml records (training title, delivery method and country). What i'd like to do is have each training on a seperate row within the overall table row. So there would be 3 mini row's within each main table row.Is this possible? I've encountered issues, and been thinking of other ways round it, but thought I'd check here first. Below is my XSL, and a sample entry from my XML.XML Sample
<training_solution>		<region>UK</region>		<comm_motor_level>Initial</comm_motor_level>		<skillset>Business Knowledge</skillset>		<subskillset>General Insurance Principles</subskillset>		<title>Insurance Principles</title>		<objectives/>		<delivery_method>LMS</delivery_method>		<glf_url>http://www.ALinkSomewhere.com</glf_url>		<comments/>	</training_solution>

XSL

<table class="glftable">	<tr align="center" style="color: #f6f5f1;" bgcolor="#89c1c5">		<td width="160px">Sub Skillset</td>		<td width="220px">Indicator</td>		<td width="220px">Title</td>		<td width="50px">Delivery Method</td>		<td width="50px">Region</td>	</tr>	<tr class="glftablerow">		<td width="200px">			<b>General Insurance Principles</b>			<br />			<ul>				<li>Utmost good faith</li>				<li>Insurable interest</li>				<li>Proximate cause</li>				<li>Indemnity</li>				<li>Subrogation</li>				<li>Contribution</li>			</ul>		</td>		<td width="220px">Can explain the core insurance principles</td>		<td width="220px">			<xsl:for-each select="training_solutions/training_solution[region='UK'][comm_motor_level='Primary'][skillset='Business Knowledge'][subskillset='General Insurance Principles']">			<a href="{glf_url}"><xsl:value-of select="title"/></a>			<br /><br />			</xsl:for-each>		</td>		<td width="40px">			<xsl:for-each select="training_solutions/training_solution[region='UK'][comm_motor_level='Primary'][skillset='Business Knowledge'][subskillset='General Insurance Principles']">				<xsl:value-of select="delivery_method"/>				<br /><br />			</xsl:for-each>		</td>		<td width="40px">			<xsl:for-each select="training_solutions/training_solution[region='UK'][comm_motor_level='Primary'][skillset='Business Knowledge'][subskillset='General Insurance Principles']">				<xsl:value-of select="region"/>				<br /><br />			</xsl:for-each>		</td>	</tr></table></xsl:template></xsl:stylesheet>

So as you can see in the XSL - there is some text in the first 2 columns, then the last 3 each use value select to grab any of the training applicable. I've used breaks for now to leave a gap between each training that appears, but I'd much prefer it to appear in seperate 'sub-rows' - also because if the title is too long, it throws out the alignment of the last two columns.Any help would be so appreciated.Thanks,John

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...