XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
microbe 0.1

I experimented with making an XSLT 1.0 stylesheet that takes an
Automatic Namespaces / Unobtrusive Namespaces "namespace definition" and
an XML instance (basically microxml except that XSLT can't really handle
microxml as currently defined) and adds the namespaces in so you can use
regular XML processing.

You can get it from http://words.fromoldbooks.org/xml/microxml/ if you
want; there's a simple and inadequate HTML 5 namespace definition file
and a sample xhtml-without-namespaces file.

The stylesheet would need a lot of work before production use, but right
now, microbe.xsl takes an optional parameter, nsduri, which can be given
a URL pointing to an "nsd" resource; if omitted, microbe looks for an
ns="..." attribute on the top level element of its input, and, if that
is not persent, falls back to looking for default.nsd in the same place
as the microbe stylesheet (probably should try relative to the XML
document first, but doesn't).

The nsd file looks like this:

<nsd>
  <title>HTML 5 Namespace Definition</title>

  <start>
    <ns>http://www.w3.org/1999/xhtml</ns>
  </start>

  <element match="html">
    <ns>http://www.w3.org/1999/xhtml</ns>
  </element>

  <element match="math">
    <ns>http://www.w3.org/1998/Math/MathML</ns>
  </element>
</nsd>

The title is ignored; right now so is "start".
The match expressions must be simple names and currently do not nest.

For example, if you run microbe.xsl with this example nsd file and an
XLM document containing html and svg elements, the html elements end up
declaring a default namespace of http://www.w3.org/1999/xhtml and the
svg elements end up declaring a default namespace of
http://www.w3.org/1999/xhtml - and no-one uses MathML, right,
David? :-) :-)

Todo:
* process include elements in the nsd file
* support attributes
* look for nsd files in the right place

It's XSLT 1 so that it could be used in a Web browser.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml
Co-author, 5th edition of "Beginning XML", Wrox, July 2012



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS