Was: [xsl] mode and moved to Namespaces

Subject: Was: [xsl] mode and moved to Namespaces
From: ac <ac@xxxxxxxxxxxxx>
Date: Sun, 17 Apr 2011 00:45:05 -0400
Hi Michael, Andrew, Gerrit,

As time goes by, I am finding more and more uses for namespaces, and implementing them efficiently seems like a growing requirement.

It seems that XSLT can be used for other things beside generating HTML and converting Office documents, and including these.

Small separate and unrelated stylesheets are fine, but is XSLT designed for those only or can it be used for more elaborate applications?

I, for one, find that XSLT is quite interesting for generalized knowledge management, and AI type applications that are well connected to general (XML) content, especially the streaming type.

One use case family that is especially interesting for namespaces is in parallel transformation pipelines, where specialized transformations can be defined, for example, on all elements and attributes of different namespaces. Accordingly, library stylesheets can be defined and specialized for each namespace. Primary/secondary keys, time and space locators, etc. can each have their own namespace-based processing, just like atom feeds, rdf triples, or any set of dedicated items.

Why limit namespaces as they can be very useful. If anythying, I would expand them. Multilevel or hierarchical namespaces would be great.

Apart from comments, of course, XML has 3 basic things: attributes, elements, and namepaces. Why prejudice namespaces? By the way, it would be nice if PI names could be namespaced also, or are they already?

Suggestions for better design approaches that also better avoid namespaces, would be much appreciated.

Since there seem to have been some demand for it, and I may have had some typos the first time, I am including a list of 76 basic namespaces currently used in a (single) stylesheet.

Andrew, I have not found that quote from the archives and I am curious as to what was the context and what could my mistake have been, or just how long ago was that?

Note that while the stylesheet requires a new namespace once in a while, typically when it starts addressing a new knowledge domain (I am currently working on a few more), it is typically the "basics", Java class interfaces, external libraries, and i18n types that tend to grow faster.

This stylesheet, once stripped of all comments and blank lines, and laid out with long lines so that instructions do not exceed a single line, with no redundancy, excluding all Java and other libraries, of which there are a few, is just under 20K lines of XSLT2. Of course, it is assembled and preprocessed from a hierarchy of included stylesheets. It also works very nicely, simple to maintain, and does quite few things, including generating some XQuery, XSLT, SQL, and Javascript.

First, you have the (22+) "basics", like

    xmlns:javascript="javascript:code"
    xmlns:xml="http://www.w3.org/XML/1998/namespace";
    xmlns:xs="http://www.w3.org/2001/XMLSchema";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:xfn="http://www.w3.org/2005/xpath-functions";
    xmlns:xdt="http://www.w3.org/2005/xpath-datatypes";
    xmlns:xqlocal="http://www.w3.org/2005/xquery-local-functions";
    xmlns:xqerr="http://www.w3.org/2005/xqt-errors";
    xmlns:xf="http://www.w3.org/2002/xforms";
    xmlns:ev="http://www.w3.org/2001/xml-events";
    xmlns:soap="http://schemas.xmlsoap.org/soap/";
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#";
    xmlns:dct="http://purl.org/dc/terms/";
    xmlns:dcam="http://purl.org/dc/dcam/";
    xmlns:dbp="http://dbpedia.org/resource/";
    xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#";
    xmlns:atom="http://www.w3.org/2005/Atom";
    xmlns:saxon="http://saxon.sf.net/"extension-element-prefixes="saxon";
    xmlns:stratml="http://www.stratml.net/PerformancePlanOrReport";

and you also have (3+) Java class interfaces, like

<saxon:script language="java"implements-prefix="Date"src="java:java.util.Date"xmlns:Date="java:java.util.Date"/>
<saxon:script language="java"implements-prefix="UUID"src="java:java.util.UUID"xmlns:UUID="java:java.util.UUID"/>
<saxon:script language="java"implements-prefix="System"src="java:java.lang.System"xmlns:System="java:java.lang.System"/>


then I have (9+) external libraries that are used, including

    xmlns:space="http://www.galasoft.net/2003/XML/javaspaces/1.0";
    xmlns:gsp="http://www.galasoft.org/2004/XML/portal/1.0";
    xmlns:mail="http://www.galasoft.org/2004/XML/mail/1.0";
    xmlns:embed="http://www.galasoft.org/2004/XML/mail/1.0";
    xmlns:gsjr="http://www.galasoft.org/2004/XML/report/jasperreports/1.0";
    xmlns:gspl="xalan://com.dnaos.xe.gs.core.util.env.Pipeline"
    xmlns:gsenv="xalan://com.dnaos.xe.gs.core.util.env.EnvironmentUtil"
  xmlns:xdbutil="xalan://com.dnaos.xe.gs.common.util.db.XMLDatabaseUtil"
    xmlns:xdbu="http://www.galasoft.org/2011/XML/xmldatabaseutil/1.0";

then I have some (38+) defined by the stylesheet itself, like

    xmlns:dna="http://www.hyperbase.com/ns/dna";
    xmlns:hyper="http://www.hyperbase.com/ns/dna/hyper";
    xmlns:regex="http://www.hyperbase.com/ns/dna/hyper/regex";
    xmlns:io="http://www.hyperbase.com/ns/dna/hyper/io";
    xmlns:sc="http://www.hyperbase.com/ns/dna/hyper/sc";
    xmlns:pk="http://www.hyperbase.com/ns/dna/hyper/sc/pk";

    xmlns:ru="http://www.hyperbase.com/ns/dna/hyper/sc/rule";
    xmlns:busy="http://www.hyperbase.com/ns/dna/hyper/sc/rule/policy";
    xmlns:cd="http://www.hyperbase.com/ns/dna/hyper/sc/rule/policy/cond";
    xmlns:tr="http://www.hyperbase.com/ns/dna/hyper/sc/rule/policy/track";
    xmlns:qy="http://www.hyperbase.com/ns/dna/hyper/sc/rule/query";
    xmlns:xq="http://www.hyperbase.com/ns/dna/hyper/sc/rule/query/xquery";
    xmlns:xp="http://www.hyperbase.com/ns/dna/hyper/sc/rule/query/xpath";
    xmlns:sql="http://www.hyperbase.com/ns/dna/hyper/sc/rule/query/sql";

    xmlns:loc="http://www.hyperbase.com/ns/dna/hyper/locator";
    xmlns:map="http://www.hyperbase.com/ns/dna/hyper/locator/geo";
    xmlns:gid="http://www.hyperbase.com/ns/dna/hyper/locator/id";
    xmlns:adr="http://www.hyperbase.com/ns/dna/hyper/locator/adr";
    xmlns:nam="http://www.hyperbase.com/ns/dna/hyper/locator/nam";
    xmlns:air="http://www.hyperbase.com/ns/dna/hyper/locator/air";
    xmlns:graph="http://www.hyperbase.com/ns/dna/hyper/graph";

    xmlns:time="http://www.hyperbase.com/ns/dna/hyper/time";
    xmlns:mu="http://www.hyperbase.com/ns/dna/hyper/time/mu";
    xmlns:muperf="http://www.hyperbase.com/ns/dna/hyper/time/mu/perf";
    xmlns:mucalc="http://www.hyperbase.com/ns/dna/hyper/time/mu/calc";

    xmlns:sched="http://www.hyperbase.com/ns/dna/hyper/time/sched";
    xmlns:wrk="http://www.hyperbase.com/ns/dna/hyper/time/work";
    xmlns:xcal="http://www.hyperbase.com/ns/dna/hyper/time/sched/xcal";
    xmlns:bio="http://www.hyperbase.com/ns/dna/hyper/time/sched/bio";

    xmlns:data="http://www.hyperbase.com/ns/dna/data";
    xmlns:doc="http://www.hyperbase.com/ns/dna/data/doc";
    xmlns:lay="http://www.hyperbase.com/ns/dna/data/lay";
    xmlns:db="http://www.hyperbase.com/ns/dna/data/db";
    xmlns:mx="http://www.hyperbase.com/ns/dna/data/db/mx";
    xmlns:cnv="http://www.hyperbase.com/ns/dna/data/app/convert";
    xmlns:fibo="http://www.hyperbase.com/ns/dna/data/app/math/fibo";
    xmlns:prim="http://www.hyperbase.com/ns/dna/data/app/math/prim";

xmlns:vi="http://www.hyperbase.com/ns/media/virtual";

then there are the (5+) language and locale oriented ones, which are especially used to build dictionaries and handle things like gender (note that I only listed English and French here), like

    xmlns:i18n="http://hyperbase.com/ns/dna/data/app/i18n";
    xmlns:en="http://hyperbase.com/ns/dna/data/app/i18n/en";
    xmlns:f-en="http://hyperbase.com/ns/dna/data/app/i18n/f-en";
    xmlns:fr="http://hyperbase.com/ns/dna/data/app/i18n/fr";
    xmlns:f-fr="http://hyperbase.com/ns/dna/data/app/i18n/f-fr";

Regards,
ac



On 15 April 2011 09:37, Michael Kay<mike@xxxxxxxxxxxx> wrote:
On 15/04/2011 09:31, Andrew Welch wrote:
I have stylesheets that use in excess of 80
namepaces, for various purposes.
Ouch. Perhaps I need to start revising my assumption that the number of
in-scope namespaces will always be small enough to make a linear search
acceptable.
Just for the archives it was 'ac' that said that.... I don't think
I've ever had more than 8 namespaces in a single stylesheet.

Current Thread