Global GuideLine Home HTML Tutorial JavaScript Tutorial SQL Tutorial CSS Tutorial SEO Tutorial XML Tutorial XSLT Tutorial Articles Tutorial Interview Questions and Answers Guide Jobs GuideLine Bookmark With Google Bookmark With Yahoo Bookmark With FaceBook Bookmark With Live Follow @GlobalGuideLine on Twitter Bookmark Global GuideLine
XSLT Copying, XSLT Tutorial, Global Guideline

Bookmark this webpage. Bookmark: XSLT Copying, XSLT Tutorial Global Guideline is UNITED STATES's favorite website


      Home                    

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"?>

<rootNode>
  Well Come at
  <nestedElement>
    Global Guide Line
    <innerElement>
      , enjoy XSLT Copying examples.
    </innerElement>
  </nestedElement>
</rootNode>

XSLT for XSLT Copying Example [XSLT_Copying_Example.xsl]

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

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

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

</xsl:stylesheet>

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

Output:
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     
 
In order to link this page as Reference, click on below text area and pres (CTRL-C) to copy the code in clipboard or pres right click then copy the following lines after that past into your website or Blog.

Get Reference Link To This Page: (copy below code by (CTRL-C) and paste into your website or Blog)
HTML Rendering of above code:

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

Copyright © 2005-2006 www.globalguideline.com All rights reserved. Join Global Guide Line community. 926 visitors are online now