xsl-list
[Top] [All Lists]

Re: [xsl] xsl:copy- of and namespaces

2008-04-01 08:19:42
Garvin Riensche wrote:

  Hi

Can someone please tell me how I can give elements of a
subtree that are copied to the output with <xsl:copy-of
select="."> a new namespace?

  The aim of xsl:copy-of is to, well, copy its arguments.
If I understand you right (but that's not sure), you want to
change the namespace URI part of the name of the elements to
copy.  So that's not excatly a copy, but a transformation:

    <xsl:template match="@*|node()">
       <xsl:copy>
          <xsl:apply-templates select="@*|node()"/>
       </xsl:copy>
    </xsl:template>

    <xsl:template match="*" priority="0">
       <xsl:element name="new:{ local-name(.) }">
          <xsl:apply-templates select="@*|node()"/>
       </xsl:element>
    </xsl:template>

  That means: copy everything, except the element nodes, in this case
create a new element node whose the name is the same local-name but in
the new namespace.

  Regards,

--drkm























      
_____________________________________________________________________________ 
Envoyez avec Yahoo! Mail. Plus de moyens pour rester en contact. 
http://mail.yahoo.fr


--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>