[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: Specifying namespaces with prefixes or URIs (Was: Re: [xsl] html tags in xml elements)


Subject: Re: Specifying namespaces with prefixes or URIs (Was: Re: [xsl] html tags in xml elements)
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Fri, 1 Mar 2002 11:23:13 +0000

Hi Peter,

> <offtopic from="xslt">
> I've never actually used xs:any, but reading the schema spec had an example 
> with <xs:any namespace="##prefix"/>.  Was I just reading it wrong?  Thanks 
> for your explanation, btw.

The XML Schema spec gives the following syntax:

<any
  id = ID 
  maxOccurs = (nonNegativeInteger | unbounded)  : 1
  minOccurs = nonNegativeInteger : 1
  namespace = ((##any | ##other) |
               List of (anyURI | (##targetNamespace | ##local)) )  : ##any
  processContents = (lax | skip | strict) : strict
  {any attributes with non-schema namespace . . .}>
  Content: (annotation?)
</any>
                    http://www.w3.org/TR/xmlschema-1/#declare-openness

The literal values ##any, ##other, ##targetNamespace and ##local
aren't specifying prefixes, but are specifying special values:

  - ##any means any namespace at all
  - ##other means any namespace aside from the target namespace of the
    schema or no namespace
  - ##targetNamespace means the target namespace of the schema
  - ##local means no namespace

Other namespaces fall under the 'anyURI' category, which is the
namespace URI.

So for example:

  <xs:any namespace="##targetNamespace ##local
                     http://www.w3.org/1999/xhtml" />

Means any element from the target namespace of the schema, no
namespace (local), or the XHTML namespace.

I think that they chose keywords beginning with ## because you can't
have URIs that start with ## (although you can have URIs that start
with # - fragment identifiers).

In XSLT, because we list prefixes instead, you can use #default for
the default namespace - we can use only one # because unlike URIs,
prefixes can't start with a #.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread