[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Vertical display

Subject: RE: Vertical display
From: Sundar Shanmugasundaram <SSHANMUGASUNDARAM@xxxxxxxxxxxxx>
Date: Mon, 28 Apr 2003 18:21:05 +0530
shanmugasundaram
Marcus,

Problem in this is 
I have to hard code the rowIndex and endIndex. This stylesheet
doesn't work for this xml file

<?xml version="1.0"?>
<o>
	<com>
		<hereyougo>
			<first>1</first>
			<second>2</second>
			<third>3</third>		
			<fourth>44</fourth>				
		</hereyougo>
		<imaycome>
			<four>4</four>
			<five>5</five>
			<six>6</six>			
			<firvi>22</firvi>			
		</imaycome>

	</com>
</o>

Any help?

thanks,
sundar

-----Original Message-----
From: Marcus Andersson [mailto:marcan@xxxxxxx]
Sent: Monday, April 28, 2003 5:33 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: 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 &gt; $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

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.