Subject: Re: [xsl] XPath equivalence question From: Hermann Stamm-Wilbrandt <STAMMW@xxxxxxxxxx> Date: Thu, 1 Dec 2011 10:43:20 +0100 |
Have you tried out what you propose as equivalent below? No XSLT processor is doing what you say, xsltproc, saxon, DataPower, ... $ saxon Graydon.1.xsl Graydon.xml ; echo <?xml version="1.0" encoding="UTF-8"?><B/> $ $ saxon Graydon.2.xsl Graydon.xml ; echo <?xml version="1.0" encoding="UTF-8"?> $ $ cat Graydon.xml <A><a><b><c><B/></c></b></a></A> $ $ cat Graydon.1.xsl <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <xsl:output method="xml"/> <xsl:template match="/"> <xsl:copy-of select="/A//B"/> </xsl:template> </xsl:stylesheet> $ $ cat Graydon.2.xsl <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <xsl:output method="xml"/> <xsl:template match="/"> <xsl:copy-of select="B[/A]"/> </xsl:template> </xsl:stylesheet> $ Mit besten Gruessen / Best wishes, Hermann Stamm-Wilbrandt Level 3 support for XML Compiler team, Fixpack team lead WebSphere DataPower SOA Appliances https://www.ibm.com/developerworks/mydeveloperworks/blogs/HermannSW/ ---------------------------------------------------------------------- IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Martin Jetter Geschaeftsfuehrung: Dirk Wittkopp Sitz der Gesellschaft: Boeblingen Registergericht: Amtsgericht Stuttgart, HRB 243294 From: Graydon <graydon@xxxxxxxxx> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx, Date: 12/01/2011 12:50 AM Subject: [xsl] XPath equivalence question Sent by: <graydon@xxxxxxxxx> Does <xsl:template match="/A//B"> match exactly the same thing as <xsl:template match="B[/A]">? My presumption is that the second form is preferable on efficiency grounds -- on simple table lookup versus whatever tree-structure the descendant axis search produces -- but I don't actually know. -- Graydon
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] can a value of a paramete, Roelof Wobben | Thread | Re: [xsl] XPath equivalence questio, Michel Hendriksen |
Re: [xsl] can a value of a paramete, Mukul Gandhi | Date | Re: [xsl] XPath equivalence questio, Michel Hendriksen |
Month |