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

Категории