Subject: Re: [xsl] Using style sheet to display XML data From: Jörg Heinicke <Joerg.Heinicke@xxxxxx> Date: Fri, 26 Oct 2001 23:39:45 +0200 (MEST) |
This is again a grouping problem. Search in the list-archive (http://sources.redhat.com/ml/xsl-list/) or look at Jeni's site (http://www.jenitennison.com/xslt/grouping/muenchian.xml). Hope this helps, Joerg > Hi, > > I'm having problems displaying my XML. I have a style sheet that > should display the XML in this form: > No Test Results Found for BOL Number: 123 234 > > BOL Number Bundle Number > 123 111 > 222 > 333 > 234 111 > > The XML data I'm using is this: > <errors> > <error> > <bundle>111</bundle> > <bol>123</bol> > </error> > <error> > <bundle>222</bundle> > <bol>123</bol> > </error> > <error> > <bundle>333</bundle> > <bol>123</bol> > </error> > <error> > <bundle>111</bundle> > <bol>234</bol> > </error> > </errors> > > My style sheet looks like this: > <table> > <tr> > <td>No Test Results Found for Bill of Lading Number:</td> > <xsl:for-each select="errors/error"> > <xsl:variable name="bolvalue" select="bol"/> > <xsl:choose> > > <xsl:when test="count(following::bol[.=$bolvalue]) !=0"> > <td><xsl:value-of select="bol"</td> > </xsl:when> > > <xsl:when test="count(preceding::bol[.=$bolvalue]) != 0"> > <td></td> > </xsl:when> > > <xsl:otherwise> > <td><xsl:value-of select="bol"/></td> > </xsl:otherwise> > </xsl:choose> > </xsl:for-each> > </tr> > </table> > > <table> > <tr> > <th>BOL Number</th> > <th>Bundle Number</th> > </tr> > <xsl:for-each select="errors/error"> > <xsl:variable name="value" select="bol"/> > <xsl:choose> > <xsl:when test="count(following::bol[.=$value]) !=0"> > <tr> > <td><xsl:value-of select="bol"/></td> > <td><xsl:value-of select="bundle"/></td> > </tr> > </xsl:when> > > <xsl:when test="count(preceding::bol[.=$value]) != 0"> > <tr> > <td></td> > <td><xsl:value-of select="bundle"/></td> > </tr> > </xsl:when> > > <xsl:otherwise> > <!-- Display all other components with single occurance --> > <tr> > <td><xsl:value-of select="bol"/></td> > <td><xsl:value-of select="bundle"/></td> > </tr> > </xsl:otherwise> > </xsl:choose> > </xsl:for-each> > </table> > > > If there are different BOL numbers, then display that after the "No > Test Results Found for BOL Number:" statement. Also, if the BOL number > is the same number, I don't want the BOL number to display beneath the > first BOL in the table. If it is a different BOL, then have it > display. > > I have ran two different tests with different XML data. The first > example seems to come out fine. But there is something funny going on > with the 2nd example. > > EXAMPLE1: > No Test Results Found for BOL Number: 123 > > BOL Number Bundle Number > 123 111 > 222 > > EXAMPLE2: > No Test Results Found for BOL Number: 123 123 > > BOL Number Bundle Number > 123 111 > 123 222 > 333 > > > Thanks for any help anyone can provide... > > Jitt -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Using style sheet to display , Jitt_Joynoosaeng | Thread | [xsl] rendering marginal XML, Jay Kline |
RE: [xsl] rendering marginal XML, Chris Bayes | Date | Re: [xsl] How to read the encoding , Jörg Heinicke |
Month |