Subject: Re: [xsl] extracting and removing an element nested at different levels From: "Mark" <mark@xxxxxxxxxxxx> Date: Wed, 5 Sep 2012 05:29:10 -0700 |
Hi Gerrit, Thanks for your suggestion. Both worked perfectly for me and produced identical results. Is there any advantage in using one technique rather than the other? Mark
xsl:for-each is often regarded as an indication of an imperative, bpull-styleb programming style. The Right Thingb" to do is to define templates, use xsl:apply-templates and let the input drive your transformation. So this general consideration will favor the first solution over the second.
To recap, the 1st solution was: 1. match List in default mode, select all descending Items and apply-templates to them in default mode 2. match Item in default mode, reproduce just this element but process contents in "suppress-item" mode 3. match Item in "suppress-item" mode, suppress it 4. otherwise, reproduce document structure identically
2nd solution: 1. match List in default mode, select all descending Items, iterate over them, reproduce them in place, process their contents 2. match Item in default mode, suppress it (the outermost items wonbt be suppressed because they will be identically reproduced above, they wonbt be processed by apply-templates) 3. otherwise, reproduce document structure identically
Ibd contend that solution 1 isnbt really a pure-play push solution but a pull solution in disguise because you select (pull) the Items explicitly. It just avoids the explicit use of xsl:for-each that XSLT hardliners (like myself) might frown upon.
But after all, that whatbs required here: pull up all Items no matter how deep theybre nested in the List.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] extracting and removing a, Imsieke, Gerrit, le- | Thread | [xsl] Bookmarks in xsl, a kusa |
Re: [xsl] extracting and removing a, Imsieke, Gerrit, le- | Date | Re: [xsl] Bookmarks in xsl, a kusa |
Month |