[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XPath equivalence question
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: 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
|
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
|