Subject: Re: select-distinct in for-each ? From: "Tangi Vass" <tangivass@xxxxxxxxxxxxxx> Date: Thu, 7 Oct 1999 15:19:31 +0200 |
Sorry, I forgot the *not* in the previous message ! Hi, David Carlisle's solution does *not* work for me (I'm using LotusXSL 0.18.2 with Sun's parser), nor Clark Evans's (I always get XXXXYZZ, whether I use normalize() or not). The only difference with the Evan's example is the stylesheet tag : <xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0" xmlns:lxslt="http://xsl.lotus.com/"> Am I doing something wrong or is it a bug in Lotus' processor? How could I get XYZ instead of XXXXYZZ? Tangi Vass ----- Original Message ----- From: Clark C. Evans <clark.evans@xxxxxxxxxxxxxxxxxxxx> To: <xsl-list@xxxxxxxxxxxxxxxx> Sent: Sunday, 03 October, 1999 10:59 Subject: RE: select-distinct in for-each ? > > On Sun, 3 Oct 1999, Jarno Elovirta wrote: > > > > ... > > Works for me if your source should've used the c instead of x. > > > > Jarno, > > Thanks for your help ... my test data was not > correctly described. As it turns out .. *blush* > David's answer is right on (which is why it is in > the FAQ). My problem was whitespace: some of my > tags had <c> X </c> and others had <c>X</c>. I've > always thought of them as equivalent... but I guess > not. *sigh* > > .. > > Can this be fixed? (remove whitespace matching problems?) > > Rather than require this strict conformance for my > XML users, I tried to modify David's distinct-select > to use normalize(), only this seems to break things. > Without the "normalize" stuff, I get exactly > what I had expected "XYZ". However, when I add > the "normalize() calls as below, it does not > seem to be doing the test ... "XXXXYZZ". > > <?xml version="1.0"?> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0" > xmlns:xt="http://www.jclark.com/xt" > extension-element-prefixes="xt"> > <xsl:template match="root"> > <xsl:for-each select="//c[not(normalize(text()) > =normalize(following::c/text()))]" > > <xsl:sort order="ascending" select="." /> > <xsl:value-of select="." /> > </xsl:for-each> > </xsl:template> > </xsl:stylesheet> > > ........ > > <?xml version="1.0"?> > <root> > <a> > <b id="101" > > <c>X</c> > </b> > <b id="102" > > <c>Y</c> > </b> > <b id="103" > > <c>X</c> > </b> > > <b id="104" > > <c>Z</c> > </b> > > <b id="105" > > <c>Z</c> > </b> > > <b id="106" > > <c>Z</c> > </b> > </a> > > <a> > <b id="201" > > <c>X</c> > </b> > > <b id="202" > > <c>Z</c> > </b> > > </a> > > <a> > <b id="301" > > <c>X</c> > </b> > > <b id="302"> > <c>X</c> > </b> > </a> > </root> > > > > > 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: select-distinct in for-each ?, Tangi Vass | Thread | add text string to output instance , Michel Goossens |
RE: Iterative XML Handling, Anthony . Behan | Date | add text string to output instance , Michel Goossens |
Month |