Re: [xsl] problems with copying duplicate nodes

Subject: Re: [xsl] problems with copying duplicate nodes
From: Mukul Gandhi <mukul_gandhi@xxxxxxxxx>
Date: Wed, 29 Jun 2005 08:09:27 -0700 (PDT)
Hi Rahil,

--- Rahil Qamar <qamar_rahil@xxxxxxxxxxx> wrote:
> <xsl:variable name="rtf">
>     <temp>
>        <xsl:copy-of select="TD" />
>     </temp>  
> </xsl:variable>
> 
> So the variable 'rtf' contained the entire TD
> content.

The variable rtf (Result Tree Fragment) contains a XML
fragment, which is part of the Result Tree ..

> <xsl:for-each select="$rtf/temp/TD[generate-id() =
> generate-id(key('by-td', .)[1])]">
>      <xsl:copy-of select="." />
> </xsl:for-each>
> 
> Then for each TD in the $rtf you checked whether
> there
> was a duplicate TD present bz comparing it with the
> first occurrence of TD.

Yes, thats true ..

> Well I must thank you for providing me with a
> solution. I had truly been struggling ! :)

I thank you for the nice problem you posted ..

Regards,
Mukul

> Thanks
> Rahil
> 
> --- Mukul Gandhi <mukul_gandhi@xxxxxxxxx> wrote:
> 
> > Hi Rahil,
> >   Please read my thoughts below your sentences ..
> > You
> > posted an interesting problem for me to find an
> > answer
> > .. Thanks..
> > 
> > --- Rahil Qamar <qamar_rahil@xxxxxxxxxxx> wrote:
> > 
> > (I am glad I was able to help ..)
> > 
> > > The solution you posted worked even with my
> Saxon
> > > 8.1.1 processor using XSLT 2.0.
> > > 
> > > Im getting the output just as I wanted but Im
> > > intrigued about the functionality of the <temp>
> > node
> > > and how it eliminated the duplicates at a later
> > > stage.
> > 
> > I used temp as a convenience element, using which
> I
> > was able to distinguish element hierarchy properly
> > ..
> > We could write the stylesheet using without it
> also
> > ..
> > But I am not sure at this moment, how we should do
> > that? I think David answered the question to this
> > some
> > time back .. Please ask him :)
> > 
> > > Just so I know how to resolve a similar query in
> > > future could you please explain what you did in
> > the
> > > <template match="TABLE/TR/TR"> block ?
> > 
> > In this template, I matched a pattern with a
> portion
> > of the result tree (which was body of the
> template)
> > ..
> > I think the explanation could be as simple as that
> > ;)
> > 
> > Regards,
> > Mukul
> > 
> > > Thanks again
> > > Rahil
> > >  
> > > 
> > > 
> > > --- Mukul Gandhi <mukul_gandhi@xxxxxxxxx> wrote:
> > > 
> > > > Hi David,
> > > >   Please read my response below your comments
> ..
> > > > 
> > > > --- David Carlisle <davidc@xxxxxxxxx> wrote:
> > > > 
> > > > > 
> > > > >   The stylesheet uses node-set function, and
> > > > > Muenchian
> > > > >   Grouping (over a RTF) .. 
> > > > > 
> > > > > It _needs_ to use a node-set function, but
> as
> > > > posted
> > > > > you did not use it
> > > > > (you need common:node-set($rtf))
> > > > 
> > > > Sorry if I am wrong. I tested the stylesheet,
> > and
> > > it
> > > > ran successfully with Saxon.
> > > > 
> > > > >   The stylesheet is tested with Saxon 8.4.
> > > > > 
> > > > > It's best not to test xslt 1 stylesheets
> with
> > an
> > > > > xslt2 processor.
> > > > > As (as in this case) many things that
> generate
> > > an
> > > > > error in xslt1 will
> > > > > not be reported.
> > > > 
> > > > You are always right :)
> > > > 
> > > > Regards,
> > > > Mukul
> > > > 
> > > > > David
> > > > > 
> > > > > 
> > > > > 
> > > > >
> > > >
> > >
> >
>
________________________________________________________________________
> > > > > This e-mail has been scanned for all viruses
> > by
> > > > > Star. The
> > > > > service is powered by MessageLabs. For more
> > > > > information on a proactive
> > > > > anti-virus service working around the clock,
> > > > around
> > > > > the globe, visit:
> > > > > http://www.star.net.uk
> > > > >
> > > >
> > >
> >
>
________________________________________________________________________
> > > > > 
> > > > > 
> > > > 
> > > > 
> > > >
> > __________________________________________________
> > > > Do You Yahoo!?
> > > > Tired of spam?  Yahoo! Mail has the best spam
> > > > protection around 
> > > > http://mail.yahoo.com 
> > > > 
> > > > 
> > > 
> > > 
> > > 
> > > 		
> > >
> >
>
___________________________________________________________
> > > 
> > > How much free photo storage do you get? Store
> your
> > > holiday 
> > > snaps for FREE with Yahoo! Photos
> > > http://uk.photos.yahoo.com
> > > 
> > > 
> > 
> > 
> > 
> > 		
> >
> ____________________________________________________
> > 
> > Yahoo! Sports 
> > Rekindle the Rivalries. Sign up for Fantasy
> Football
> > 
> > http://football.fantasysports.yahoo.com
> > 
> > 
> 
> 
> 
> 		
>
___________________________________________________________
> 
> How much free photo storage do you get? Store your
> holiday 
> snaps for FREE with Yahoo! Photos
> http://uk.photos.yahoo.com
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Current Thread