Subject: RE: [xsl] Duplicate elements. HELP! From: "Michael Kay" <mhk@xxxxxxxxx> Date: Sun, 6 Jun 2004 21:39:05 +0100 |
Your wrote <xsl:for-each select="CompanyResults/CompanyResult[not (./CompanyTitle=preceding::CompanyResults/CompanyResult/CompanyTitle)]"> No CompanyResult has a preceding CompanyResults, because ancestors of an element are not included on the preceding axis. Even if they were, this condition wouldn't work because the CompanyResult children of the CompanyResults include the element you started from, which is always equal to itself. You want <xsl:for-each select="CompanyResults/CompanyResult[not (CompanyTitle=preceding-sibling::CompanyResult/CompanyTitle)]"> Michael Kay > -----Original Message----- > From: Stoaks, Max [mailto:Stoaks_Max@xxxxxxxxxxxxxxxx] > Sent: 06 June 2004 18:19 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Cc: Stoaks, Max > Subject: [xsl] Duplicate elements. HELP! > > Hi, > > I'm trying to ignore duplicate elements and having trouble > with the XPath syntax. I'm hoping some kind soul can help... > > > Here's my xml: > <CompanyResults> > <CompanyResult> > <CompanyTitle>IBM</CompanyTitle> > <CompanyContact>Joe</CompanyContact> > </CompanyResult> > <CompanyResult> > <CompanyTitle>IBM</CompanyTitle> > <CompanyContact>Joe</CompanyContact> > </CompanyResult> > <CompanyResult> > <CompanyTitle>Intuit</CompanyTitle> > <CompanyContact>Claudia</CompanyContact> > </CompanyResult> > <CompanyResult> > <CompanyTitle>IBM</CompanyTitle> > <CompanyContact>Joe</CompanyContact> > </CompanyResult> > </CompanyResults> > > I want to ignore any CompanyResult that has a CompanyTitle > that has already occured. > > <xsl:template match="/"> > <xsl:for-each select="CompanyResults/CompanyResult[not > > (./CompanyTitle=preceding::CompanyResults/CompanyResult/Compan > yTitle)]"> > <xsl:value-of select="CompanyTitle"/> > </xsl:for-each> > > Any help would be greatly appreciated as I've been pulling my > hair out about this... > > I'm using XalanJ 2.6. > > Thanks! > Max > > > --+------------------------------------------------------------------ > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/ > or e-mail: <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx> > --+-- > >
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Duplicate elements. HELP!, Stoaks, Max | Thread | Lookup table and maintaining hierar, Mir Farooq Ali |
Lookup table and maintaining hierar, Mir Farooq Ali | Date | RE: [xsl] Lookup table and maintain, Michael Kay |
Month |