[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Duplicate Elimination
ha ha recreating the date element and applying templates another nice trick. On Wed, Mar 12, 2014 at 9:14 PM, Martin Holmes <mholmes@xxxxxxx> wrote: > If the text content of the element is all you care about, you could do > something like this: > > <xsl:variable name="distinctDates"> > <xsl:for-each select="distinct-values(A/Date | B/Date)"> > <xsl:sort/> > <Date><xsl:value-of select="."/></Date> > </xsl:for-each> > </xsl:variable> > > <xsl:apply-templates select="$distinctDates/Date"/> > > > > > On 14-03-12 01:34 PM, Ihe Onwuka wrote: >> >> I have Date elements coming from 2 different parents. >> >> <A> >> <Date>blah</Date> >> </A> >> >> <B> >> <Date>blah</Date> >> </B> >> >> I am doing >> >> <xsl:apply-templates select="A/Date | B/Date> >> <xsl:sort select="." order="ascending"/> >> </xsl:apply-templates> >> >> and >> >> <xsl:template match="Date"> >> etc >> </xsl:template> >> >> I have noticed that when A and B have a child element of the same date >> the Date template gets fired on each occasion, whereas I only want it >> fired once >> >> I thought the union operator in the apply-templates would have the >> effect of eliminating duplicates or aren't they duplicates if they >> have the same content but come from different parents.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|