[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: RE: [xsl] XSL to HTML table problem
Subject: Re: RE: [xsl] XSL to HTML table problem From: James Hunt <arcjah@xxxxxxxx> Date: Wed, 29 Jan 2003 14:57:13 -0500 |
This worked perfectly. Thanks Roger. Can you point me to where I can find the position() function? And maybe some other functions similar to it. -James > > From: "Roger Glover" <glover_roger@xxxxxxxxx> > Date: 2003/01/29 Wed PM 12:53:31 EST > To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> > Subject: RE: [xsl] XSL to HTML table problem > > James [mailto:arcjah@xxxxxxxx] wrote: > > > I have an xml document that looks like the following: > > <Dictionary> > > <WordDefinition> > > <Word>Some Word</Word> > > <Definition>First Definition</Definition> > > <Definition>Second Definition</Definition> > > <Definition>Third Definition</Definition> > > </WordDefinition> > > <WordDefinition> > > <Word>Second Word</Word> > > <Definition>First Definition</Definition> > > <Definition>Second Definition</Definition> > > </WordDefinition> > > </Dictionary> > > > > I have an xslt document that looks like the following: > o / > ----X---------- <snip> > O \ > > <xsl:for-each select="Dictionary/WordDefinition"> > > <xsl:sort select="Word"/> > > <tr bgcolor="#99CCFF"><td><xsl:value-of > select="Word"/></td><td><br/></td></tr> > > <xsl:for-each select="Definition"> > > <tr bgcolor="#99CCAA"><td><br/></td><td><xsl:value-of > select="."/></td></tr> > > </xsl:for-each> > > </xsl:for-each> > o / > ----X---------- <snip> > O \ > > (My problem is, I want the word and first definition on the same row.) > > The above xsl transforms the xml document into a html document > > that has the word on one row, in the first column and the > > defintions in the second, third and forth row in the second column. > > > > Again I want to figure out how to make the word and first > > definition sit on the same row. > > > > I've heard about indexing the elements but I've never seen any > > examples of this. > > Try the following in place of the isolated portion above: > > <xsl:for-each select="Dictionary/WordDefinition"> > <xsl:sort select="Word"/> > <tr bgcolor="#99CCFF"> > <td><xsl:value-of select="Word"/></td> > <td><xsl:value-of select="Definition[1]"/></td> <!-- first def --> > </tr> > <xsl:for-each select="Definition[position() > 1]"> <!-- later defs --> > <tr bgcolor="#99CCAA"> > <td><br/></td> > <td><xsl:value-of select="."/></td> > </tr> > </xsl:for-each> > </xsl:for-each> > > > -- Roger Glover > glover_roger@xxxxxxxxx > > > > 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: RE: [xsl] XSL to HTML table pro, Roger Glover | Thread | RE: [xsl] XSL to HTML table problem, Ross Ken |
Re: RE: [xsl] XSL to HTML table pro, James Hunt | Date | RE: [xsl] constructing the Node Set, David Carlisle |
Month |