xsl-list
[Top] [All Lists]

Re: [xsl] Xsl:copy-of writes xmlns:xsi always - Any way to avoid this?

2007-03-05 03:08:38
binu(_dot_)idicula(_at_)wipro(_dot_)com wrote:
I used the following .. But the problem was that it is not copying
nested. It just copies the direct chile element nodes. If the child element has
another child, do I have to write one more for-each OR is there a simple
way.

            <xsl:for-each select="./*">
                <xsl:element name="{name()}"
namespace="{namespace-uri()}">
                <xsl:copy-of select="@*"/>
                <xsl:apply-templates/>
            </xsl:element>
            </xsl:for-each>

Once I select a particular node, all the contents (including next level
- children) should be translated to another XML. Please advice

Michael was not talking of a for-each loop, which only walks through the selected node set. He meant (and gave an example of) a modified identity template which is the generic way of processing an input tree and modify only small parts of it. Use template matches instead of for-each to achieve that effect (see Michaels original answer).

--~------------------------------------------------------------------
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(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--