Subject: Re: [xsl] Moving elements during identity transformation From: Dimitre Novatchev <dnovatchev@xxxxxxxxx> Date: Fri, 3 Sep 2010 09:41:47 -0700 |
See this: http://stackoverflow.com/questions/3632244/move-certain-child-nodes-down-to-a -new-grandchild-level/3632373#3632373 -- Cheers, Dimitre Novatchev --------------------------------------- Truly great madness cannot be achieved without significant intelligence. --------------------------------------- To invent, you need a good imagination and a pile of junk ------------------------------------- Never fight an inanimate object ------------------------------------- You've achieved success in your field when you don't know whether what you're doing is work or play On Wed, Sep 1, 2010 at 8:49 AM, Martynas Jusevicius <martynas.jusevicius@xxxxxxxxx> wrote: > Hey list, > > I'm doing an identity transformation which cleans up, filters and > moves around elements from my source document. > > Let's say there is <ToC> anywhere in the document, and from there it > has to be moved directly *before* <Index> element, wherever that one > is. > > What I'm doing is this: > > B B B B <xsl:template match="Index"> > B B B B B B B B <xsl:apply-templates select="/ToC"/> <!-- lets just say this selects ToC --> > B B B B B B B B <xsl:copy> > B B B B B B B B B B <xsl:apply-templates select="@* | node()"/> > B B B B B B B B </xsl:copy> > B B B B </xsl:template> > > So the <ToC> is now at its new location, but the old one has still to > be removed: > > B B B B <xsl:template match="ToC"/> > > Now the problem is, this will also remove the new <ToC>. Since this is > a identity transformation, I don't want to use <xsl:copy-of>, as some > of the <ToC> descendants might also need processing. > > What do you do in such situation? > The only thing I can think of is introducing some parameter like $keep > in the <ToC> template and then pass it from the <Index> template to > differentiate between the two cases. > > Thanks, > > Martynas > semantic-web.dk
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Moving elements during id, Martynas Jusevicius | Thread | [xsl] Creating exception in process, Gábor Tóth |
Re: [xsl] tokenize function behavio, Bartolomeo Nicolotti | Date | RE: [xsl] Selecting lots of nodes w, Fabien Tillier |
Month |