Subject: RE: [xsl] Vertical display From: Sundar Shanmugasundaram <SSHANMUGASUNDARAM@xxxxxxxxxxxxx> Date: Mon, 28 Apr 2003 18:21:05 +0530 |
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: [xsl] 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: [xsl] 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Vertical display, Sundar Shanmugasunda | Thread | Re: [xsl] Vertical display, Marcus Andersson |
RE: [xsl] Date formatting using XSL, Kaine Varley | Date | RE: [xsl] Vertical display, Sundar Shanmugasunda |
Month |