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

RE: Why namespaces?

  • From: Mark Birbeck <Mark.Birbeck@i...>
  • To: xml-dev@i...
  • Date: Sat, 4 Sep 1999 16:53:39 +0100

RE: Why namespaces?
James Clark wrote:
> Mark Birbeck wrote:
> 
> > A template of 'P' would match all elements that have a local
> > name 'P', regardless of the namespace they came from,
> 
> Not true.  It matches a P whose expanded-name has a local 
> name of P and a null namespace URI.

Many, many, apologies. I was looking at Section 5.5 of XSLT which
discusses the pecking order in which patterns would be matched. I
understood it to mean that if I had:

    <xsl:template match="x:para">
        ...
    </xsl:template>

it would score higher than:

    <xsl:template match="para">
        ...
    </xsl:template>

when processing the first 'para' node in the tree:

    <doc xmlns="z">
        <para xmlns="x" />
        <para xmlns="y" />
    </doc>

but lower (actually, not at all) when processing the second 'para'
element.

Although this scoring mechanism is right, the mistake I made was
thinking that the template rules were expanded in the context of the
node that was being processed - i.e., that:

    match="para"

would be:

    match="x:para"

in one situation and:

    match="y:para"

in another. However, looking at XPath again (Section 2.3), I realise
that the node context is from the element that contains the XPath
expression (in this case the template), and not the source document. And
this is obviously why as a rule XPath doesn't provide the default
namespace as one of the namespaces provided in the node context -
because it would be the wrong default (from XSLT, in this case, not the
source).

So, as you say, the definition of the pattern 'para' would be just that
... 'para' (or <NULL>:para as an expanded name). And, patterns with a
NULL namespace will only match elements from the default namespace in
the source document.

Sorry if I caused any confusion.

Best regards,

Mark

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo@i... the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)



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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.