xsl-list
[Top] [All Lists]

Re: [xsl] Namespaces on attributes

2012-02-29 11:59:57
Mike and David,

As always, thanks for your promptness and sound advice.

On 2/29/2012 12:15 PM, Michael Kay wrote:
It was recently shown to me that (using a recent Saxon) this template

<xsl:template match="@schemaLocation"
xpath-default-namespace="http://www.w3.org/2001/XMLSchema-instance"/>

does not match the @xsi:schemaLocation here:

<ead xmlns:xlink="http://www.w3.org/1999/xlink";
xmlns="urn:isbn:1-931666-22-9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="urn:isbn:1-931666-22-9
http://www.loc.gov/ead/ead.xsd";>

I am at a loss to explain this.

It took me a while too.

xpath-default-namespace sets the "default namespace for element and type
names". It doesn't affect attribute names. As in XML, unprefixed
attribute names are in no namespace, regardless of any default namespace.

Okay.

But methinks this means, as respects attributes with namespace-qualified names, there is a hole, inasmuch as there is no way to address them without declaring prefixes for their names. (Effectively a residuum of the XSLT 1.0 situation.)

I understand that unprefixed attribute names are not in the default namespace (and understand why it would be bad if they were, and how this disjunction stems from the way the design of namespaces straddles syntax and model), so I guess it makes sense they can't be bound to a namespace at all ...

... but it does make for a gotcha. One more to file away (and I am not surprised it has to do with namespaces).

Thanks again,
Wendell


Michael Kay
Saxonica

--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--
======================================================================
Wendell Piez                            
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>