Subject: Re: [xsl] XPath equivalence question From: Michel Hendriksen <michel.hendriksen@xxxxx> Date: Thu, 1 Dec 2011 10:50:25 +0100 |
Just to be curieus doesn't <xsl:template match="B[/A]"> mean match a B when there is an A underneath the root, not necessarily the parent of B? Michel On Thu, Dec 1, 2011 at 10:43 AM, Hermann Stamm-Wilbrandt <STAMMW@xxxxxxxxxx> wrote: > 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] XPath equivalence questio, Hermann Stamm-Wilbra | Thread | Re: [xsl] XPath equivalence questio, David Carlisle |
Re: [xsl] XPath equivalence questio, Hermann Stamm-Wilbra | Date | Re: [xsl] XPath equivalence questio, David Carlisle |
Month |