Re: [xsl] Optimizing identity template

Subject: Re: [xsl] Optimizing identity template
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 22 Jan 2009 00:08:14 GMT
It's more natural I think to use the template of the parent to add a new
last child rather than the template for the last child. (think of the
limiting case where there are no children initially, if you are matching
the parent then you would add a new child, but if you match the last
child then that will not fire as their are no children.

Also if you want to copy a whole branch, copy-of is probably quicker
that an identity template, since it (perhaps, depending on
iplementation) doesn't have to walk the tree, and doesn't have to look
up matching templates on every node.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"

        <xsl:output method="xml" omit-xml-declaration="no" indent="yes" encoding="UTF-8"/>
        <xsl:template match="/">
                <xsl:apply-templates select="document($basemap)/svg:svg"/>

        <xsl:template match="/svg:svg">
<xsl:copy-of select="@*|node()"/>
                <circle xmlns="";
                cx="100px" cy="100px" r="5px"
                fill="#ff0000" stroke="#000000" stroke-width="1px"/>



The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 

Current Thread