|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] [no subject]"The xsl:copy instruction provides a way of copying the context item. If the context item is a node, evaluating the xsl:copy instruction constructs a copy of the context node, and the result of the xsl:copy instruction is this newly constructed node. By default, the namespace nodes of the context node are automatically copied as well, but the attributes and children of the node are not automatically copied." So the processor will notionally now create an empty <root> </root> element in the result tree. It then looks at the body of the xsl:copy instruction, to see what else it has to do. In this case, it is instructed to apply templates that match all the elements attributes and child nodes. In this case there are no attributes, but we do have some element children (there may also be white-space text nodes, depending on whether or not they have been stripped - let's assume none for the moment). The first element child it finds is the element: <file name="test.java"> So it will then try to find a template that matches this node. If you don't have any more specific templates to match this, then the identity template will match it. So it will copy it (execute the xsl:copy instruction in the template). Now the result tree looks like: <root> <find> </find> </root> At which point it will try to execute the body of the xsl:copy again. This time it finds and attribute node (name="test.java"), so it will try to match that. Again, if you have no more specific template than the identity template, the identity template will match. So the processor will execute the xsl:copy instruction in the template, and the result tree will now look like this: <root> <find name="test.java"> </find> </root> At which point it will try to execute the body of the xsl:copy again. This time it finds no attributes or child nodes (an attribute node has no children or attribtes), so it finishes that invocation of the identity template, and resumes on the previous one where it left off (matching the attribute name in the find element). It will discover that find has no more attributes or child nodes, so it will finish exceuting that invocation of the identity template too, and resumes on the previous one where it left off (matching the find child of the root element). It will look for further children of the root element, and will find the first error element, so it will attempt to match that. Again, if you have no more specific template than the identity template, the identity template will match. Etc. etc. -- Colin Adams Preston Lancashire
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

![[no subject]](/images/get_stylus.gif)




