XSLT Copying, XSLT Tutorial, Global Guideline

Bookmark Bookmark: XSLT Copying, XSLT Tutorial
Forum | Blog


Basic XSLT Tutorial.     
 XSLT Introduction.          
 XSLT Templates.            
 XSLT Attributes.              
 XSLT Transformation.     
 XSLT Variables.              
 XSLT Formatting.            
 XSLT Loops.                   
 XSLT Sorting.                 
 XSLT Conditions.             
 XSLT Multi Selection.     
 XSLT Functions.              
 XSLT Copying.
 XSLT Combining.           
 XSLT Summary.              

XSLT Tutorial >> XSLT Copying.

     Back             Next     

XSL copying is used for creation of duplication of XSLT nodes. The <xsl:copy> element creates a copy of the current node in XSLT.

Namespace nodes of the current node are automatically copied as well, but child nodes and attributes of the current node are not automatically copied!

How do we copy all of or a portion of an XML document exactly? The following code fragment shows how to do that exactly of our requirement. Using this XSLT template for an entire XSLT file or for a portion of a document, we will copy the contents of a particular node exactly. XSLT Tutorial section of XSLT Copying will be very useful if we want to leave a large portion of a document unchanged.

Example of XSLT Copying

XML for XSLT Copying Example [XSLT_Copying_Example.xml]

<?xml version="1.0" ?>
<?xml-stylesheet type="text/xsl" href="XSLT_Copying_Example.xsl"?>

  Well Come at
    Global Guide Line
      , enjoy XSLT Copying examples.

XSLT for XSLT Copying Example [XSLT_Copying_Example.xsl]

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="https://www.w3.org/1999/XSL/Transform" version="1.0">

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

  <xsl:template match="nestedElement">
      XSLT Tutorial at Global Guide Line
      <xsl:apply-templates select="*" /> 


Complete Example of XSLT Copying

View complete sources and outputs by simply clicking on file name of XSLT, XML and Out Put of XSLT Copying Example.

Output of XSLT Copying with Explanation

Well Come at XSLT Tutorial at Global Guide Line , enjoy XSLT Copying examples.

Here we want to copy this, but change the text of <nestedElement>, instead of Global Guide Line our requirement is XSLT Tutorial at Global Guide Line

     Back             Next     

[ About ] [ Contact ] [ Home ]
[ Links ] [ Site Map ] [ Services ] [ Privacy ]

Copyright 2005 -  2021 www.globalguideline.com All rights reserved. (Best viewed in IE 6.0+ or Firefox 2.0+ at 1024 * 768 or higher) 495 visitors are online now