thanks allot. But I have to say I'm a bit baffled. To my understanding
this template copies only all the attributes (which I thought was
<element attribute="...">). How come this copies also the child
elements and the text???
google for "XSLT identity template" and you'l find gazillions of
examples of this, in teh archives and faq of the list (there's also an
example in the xslt1 spec)
the template copies elements (xsl:copy), then the elements attributes
(copy-of, then recursively applies templates to children.
If this template matched all nodes, you would end up copying everything,
same as if you had just done xsl:copy-of (but slower, probably) but
using templates means you can make specific nodes do something else.
In particular here the match is just on * (so just elements) so comments
and pi nodes will be processed by their default templates (which throw
them away) and text is processed by its default template (which copies
DC> <xsl:template match="*" mode="copy">
DC> <xsl:copy-of select="@*"/>
DC> <xsl:apply-templates mode="copy"/>
>> The element() function seems to copy the comment
>> as well. What am I doing wrong here?
DC> If you copy an element node then the copy has exatly the same children
DC> as the original (or rather has copies of those children) so it has teh
DC> smae text, comments and child elements.
So for that matter if I <xsl:copy-of select="child::element()"/> it
produces a deep-copy with which I don't have the opportunity to check
which parts I do and which I do not want to copy, right?
right, select="child::eleemnt()" can more simply be written select="*"
(Also the element() node test (it's not a function) is a new XPath2
feature, but if used with no argument it's just new syntax for the
existing feature provided by *.
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:
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>