Copying All Elements

 
xslt for dummies
Chapter 6 - We Want Results!
XSLT For Dummies
by Richard Wagner
Hungry Minds 2002
  

To copy the entire set of elements in a document, you can use the same xsl:copy-of instruction that you use to copy a single element and its children. To copy the whole enchilada, use the xsl:copy-of instruction within the context of the root node (using / as the match pattern):

 <!-- coffee-copy_tree.xsl --> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <xsl:copy-of select="."/> </xsl:template> </xsl:stylesheet> 

When this template rule is run, the output looks identical to the original coffee.xml document tree. xsl:copy-of even brings along processing instructions and comments for the ride. Now thats service!

  
 
 
2000-2002    Feedback


XSLT For Dummies
XSLT for Dummies
ISBN: 0764536516
EAN: 2147483647
Year: 2002
Pages: 148

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net