[xsl] Translating Arrays into HTML

Subject: [xsl] Translating Arrays into HTML
From: "Rajput, Ashish S" <ashish.s.rajput@xxxxxxxx>
Date: Wed, 05 Jun 2002 09:38:42 -0500
I'm trying to translate Arrays into a HTML table.  I did get part of the
translation working, but being a newbie to XSLT, I get confused at a certain
part.  Kindly help with the XSLT!  Listed below is the target output, and a
part of the XML file.  Thank you!

Ashish


*************************************************
Target Output:
*************************************************
__________________________________________________
| Cross Section Factor		|  Reflection Type  |  Value|
----------------------------------------------------------------------------
-----------
|				|  Radar		  |  0.5	  |
----------------------------------------------------------------------------
-----------
|				|  Sonar		  |  0.4	  |
----------------------------------------------------------------------------
-----------


****************************************************************************
**
XML File:
****************************************************************************
**
<array name="Cross Section Factor">
	<fieldAxis fieldAxisID="columns">
		<field name="Reflection Type">
			<units>
				<unitless/>
			</units>
			<dataFormat>
				<float/>
			</dataFormat>
		</field>
		<field name="Value">
			<units>
				<unitless/>
			</units>
			<dataFormat>
				<float/>
			</dataFormat>
		</field>
	</fieldAxis>
	<axis axisID="rows" axisDataType="integer">
		<axisUnits>
			<unitless/>
		</axisUnits>
	</axis>
	<read encoding="UTF-8">
		<tagToAxis tag="d1" axisIDRef="columns"/>
		<tagToAxis tag="d0" axisIDRef="rows"/>
	</read>
	<data>
		<d0>
			<d1>Radar</d1>
			<d1>.5</d1>
		</d0>
		<d0>
			<d1>Sonar</d1>
			<d1>.4</d1>
		</d0>
	</data>
</array>


*****************************************
Current XSLT:
*****************************************
<xsl:template match="array">
<tr><td>
<xsl:for-each select="(./ancestor::*)">></xsl:for-each>
			 <font color="red"><span style="font-size:medium;
font-weight:bold">
	<xsl:value-of select="@name" />
	                            </span></font>
<xsl:apply-templates />  
 </td>  </tr>
</xsl:template>

<xsl:template match="field">
	<td><xsl:value-of select="@name" /></td>
</xsl:template>

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


Current Thread