This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Sorting list of XML data into multiple columns



I shouldn't have sent such messy code - here is a clearer version of what I
sent before...

<xsl:template name="paymentsystemcurrency">
	<xsl:for-each select="document('../currency.xml')/select/option">
		<xsl:choose>
			<xsl:when test="position() mod 3 = 1">
		<![CDATA[ <tr> ]]>
			<td>
				<xsl:call-template name="checkboxcurrency" />
			</td>
			</xsl:when>
			<xsl:when test="position() mod 3 = 2">
			<td>
				<xsl:call-template name="checkboxcurrency" />
			</td>
		</xsl:when>
		<xsl:otherwise>
			<td>
				<xsl:call-template name="checkboxcurrency" />
			</td>
</xsl:template>

<xsl:template name="checkboxcurrency">
	<xsl:choose>
		<xsl:when test="option[@iso]/selected=yes">
			<input type="checkbox" name="payment/currency[@iso]/selected" value="yes"
checked="checked" />
		</xsl:when>
		<xsl:otherwise>
			<input type="checkbox" name="payment/currency[@iso]/selected" value="yes"
/>
		</xsl:otherwise>
	</xsl:choose>
	<xsl:value-of select="@iso"/>
</xsl:template>

As I mentioned before, this method is full of problems and I shouldn't need
to use CDATA stuff,
and this doesn't account for a number of countires/currencies which isn't
divisable by three.

Thanks again, Tim


-----Original Message-----
From: owner-xsl-list@lists.mulberrytech.com
[mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of Tim Watts
Sent: Thursday, 29 March 2001 11:32 AM
To: xsl-list@lists.mulberrytech.com
Subject: [xsl] Sorting list of XML data into multiple columns


Hi,

I have come across a problem which I am sure will have been solved before.

In the XML I have a list of countries which I would like displayed in
columns in html in the form wirth check boxes...

<table>
  <tr>
    <td>country A</td>
    <td>country B</td>
    <td>country C</td>
  </tr>
  <tr>
    <td>country D</td>
    <td>country E</td>
    <td>country F</td>
  </tr>
....
</table>

The data is already sorted in the XML to save complexity there,

How can I go about this? Tests of position are not going to work with the
countires to detemine when the <tr> closes and the next one begins, because
the templates need to complete the <tr>

Thanks for all help and advice

Tim


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]