|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Vertical display
These templates produces the output you want. There must, however, be an easier way...
/Marcus
<xsl:template match="com">
<table>
<xsl:call-template name="verticalTable">
<xsl:with-param name="rowIndex" select="1"/>
<xsl:with-param name="endIndex" select="3"/>
</xsl:call-template>
</table>
</xsl:template>
<xsl:template name="verticalTable">
<xsl:param name="rowIndex"/>
<xsl:param name="endIndex"/>
<xsl:if test="not($rowIndex > $endIndex)">
<xsl:call-template name="doRow">
<xsl:with-param name="rowIndex" select="$rowIndex"/>
</xsl:call-template>
<xsl:call-template name="verticalTable">
<xsl:with-param name="rowIndex" select="$rowIndex + 1"/>
<xsl:with-param name="endIndex" select="$endIndex"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="doRow">
<xsl:param name="rowIndex"/>
<xsl:variable name="nodes" select="/o/com/*"/>
<xsl:if test="$nodes">
<tr>
<xsl:for-each select="$nodes">
<td><xsl:value-of select="*[position() = $rowIndex]"/></td>
</xsl:for-each>
</tr>
</xsl:if>
</xsl:template>
----- Original Message -----
From: "Sundar Shanmugasundaram" <SSHANMUGASUNDARAM@xxxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Monday, April 28, 2003 12:43 PM
Subject: Vertical display
> <?xml version="1.0"?>
> <o>
> <com>
> <hereyougo>
> <first>1</first>
> <second>2</second>
> <third>3</third>
>
> </hereyougo>
> <imaycome>
> <four>4</four>
> <five>5</five>
> <six>6</six>
>
> </imaycome>
> <imaycome1>
> <four1>41</four1>
> <five1>51</five1>
> <six1>61</six1>
>
> </imaycome1>
> <imaycome2>
> <four2>42</four2>
> <five2>52</five2>
> <six2>62</six2>
>
> </imaycome2>
>
> </com>
> </o>
>
> Hi,
>
> This is the xml file. I want to display in HTML table as follows :
>
> 1 4 41 42
> 2 5 51 52
> 3 6 61 62
>
> How will i do that?
>
> Please give XSL template.
>
> thanks and regards,
> sundar
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








