A place for SGML and XML application developers.

April 3, 2006

Create an Exact Copy of a Document using XSLT

Filed under: XSLT — cangione @ 1:59 pm

I get this request all the time so here is an example. It also shows you how to handle cases where you want to do something specific to certain elements while doing the copy.

<?xml version="1.0" encoding="UTF-8" ?>

    Document   : Create Copy of Document
    Created on : April 3, 2006
    Author     : sgmlxmldotnet
       Demo file for Creating an Exact Copy of the document.

<xsl:stylesheet version="1.0"
    <!-- template rule matching source root element -->
    <xsl:template match="/|*|comment()">
       <xsl:call-template name="do_copy"/>

<!-- Add additional template matches here -->

<!-- Named Templates -->
	<!-- Copy current element and attribute nodes -->
	<xsl:template name="do_copy">
        	<xsl:for-each select="@*">


No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

You must be logged in to post a comment.

Powered by WordPress