[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
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" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:svg="http://www.w3.org/2000/svg"> <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> <xsl:template match="/svg:svg"> <xsl:copy> <xsl:copy-of select="@*|node()"/> <circle xmlns="http://www.w3.org/2000/svg" cx="100px" cy="100px" r="5px" fill="#ff0000" stroke="#000000" stroke-width="1px"/> </xsl:copy> </xsl:template> </xsl:stylesheet> David ________________________________________________________________________ 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Optimizing identity template, Jacek Iwański | Thread | RE: [xsl] Optimizing identity templ, Michael Kay |
[xsl] Optimizing identity template, Jacek Iwański | Date | Re: [xsl] Moving an element to a di, Rob Newman |
Month |