[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XPath equivalence question

Subject: Re: XPath equivalence question
From: Hermann Stamm-Wilbrandt <STAMMW@xxxxxxxxxx>
Date: Thu, 1 Dec 2011 10:43:20 +0100
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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.