W3C home > Mailing lists > Public > public-i18n-its@w3.org > January to March 2006

Re: using <ns> to specify namespaces

From: Felix Sasaki <fsasaki@w3.org>
Date: Thu, 02 Feb 2006 15:14:28 +0900
To: "Yves Savourel" <yves@opentag.com>, public-i18n-its@w3.org
Message-ID: <op.s4b0yeirx1753t@ibm-60d333fc0ec.mag.keio.ac.jp>

Hi Yves, Sebastian, all,

I have not tried it yet. Just a comment below.

On Thu, 02 Feb 2006 10:06:24 +0900, Yves Savourel <yves@opentag.com> wrote:

>
> I did try it as well it's working fine so far.
>
> But I'm not sure what advantages it brings compare to simply having a  
> normal namespace declaration. For example:
>
> <its:documentRules>
>  <its:ns its:prefix="h" its:uri="http://www.w3.org/1999/xhtml" />
>  <its:documentRule its:translate="no"  
> its:translateSelector="//h:tr/@title" />
>  <its:documentRule its:translate="no" its:translateSelector="//h:td" />
> </its:documentRules>
>
> Or
>
> <its:documentRules xmlns:h="http://www.w3.org/1999/xhtml">
>  <its:documentRule its:translate="no"  
> its:translateSelector="//h:tr/@title" />
>  <its:documentRule its:translate="no" its:translateSelector="//h:td" />
> </its:documentRules>
>
> Makes no difference as far as what I have to do: Add a namespace to the  
> namespace manager of the prcessed document. I also presume
> that I still would have to solve any potential prefix conflict.
>
> Actually using <its:ns> makes things just a tad more complex because it  
> forces the addition of the namespace via an extra step (not
> very expensive but still extra), while doing it via xmlns:h is done  
> regardless of whether its rules are there or not.

Talking from the XSLT / XQuery perspective: Both Sebastians and my  
implementations need to copy the string values of the selector attributes  
into generated XSLT stylesheet / XQuery files. So we need an extra step  
anyway to generate zero or more xmlns elements in these files, so that the  
XSLT / XQuery processor understands these values as "namespace using"  
XPath expressions.

This task seems to me easier to do with the <its:ns> element, rather than  
analyzing xmlns attributes at "its:documentRules". Although the task would  
be not impossible for XQuery, I think. Sebastian, what do you think about  
XSLT?

What would worry my about using "xmlns" at "documentRules" is that this  
could interfere with the markup of the document which contains the  
"documentRules" elements. Imagine you would use a "literate programming"  
approach for documenting "documentRules" with HTML:

<html xmlns:h="http://www.w3.org/1999/xhtml">
<title>HTML file including document rules</title>
....

<its:documentRules xmlns:h="http://www.w3.org/1999/xhtml">
<h:p>Some explanation of the document rules</h:p>
  <its:documentRule its:translate="no"  
its:translateSelector="//h:tr/@title" />
  <its:documentRule its:translate="no" its:translateSelector="//h:td" />
</its:documentRules>
...</html>

For the "p" element inside the "its:documentRules" element you now need a  
prefix "h". It would work, but could become messy, I guess ...
Btw., at http://www.topologi.com/resources/schematronUpgrades.html , there  
is a summary of the discussion "pro and cons of <ns> elements" (search for  
"9. Namespace"). Of course it is from the "pro" perspective ;)

The W3C Tag [1] has described at [2], that it is o.k. to use our "own"  
mechanism for namespace bindings, like <ns>. XPointer [3] is an example  
which also avoids "xmlns" and creates its own binding method. Well, I  
guess these are more architectural (philosophical?) questions ...

- Felix

[1] http://www.w3.org/2001/tag/
[2] http://www.w3.org/2001/tag/doc/qnameids.html#bindings
[3] http://www.w3.org/TR/xptr-framework/#nsContext




>
> Mmmm... Still thinking...
>
> -ys
>
> -----Original Message-----
> From: public-i18n-its-request@w3.org  
> [mailto:public-i18n-its-request@w3.org] On Behalf Of Sebastian Rahtz
> Sent: Wednesday, February 01, 2006 4:14 PM
> To: public-i18n-its@w3.org
> Subject: using <ns> to specify namespaces
>
>
> Just to report that a quick trial shows the notation proposed by Felix  
> is easy to implement in XSLT. I changed my dislocated rules
> to
>
>   <documentRules xmlns="http://www.w3.org/2005/11/its">
>        <ns its:prefix="t" its:uri="http://www.tei-c.org/ns/1.0"/>
>        <documentRule its:translate="no"
>                      its:translateSelector="//t:body/t:p/@*"/>
> ....
>
>
> and I was able to generate an XSLT stylesheet from that which associated  
> "t:" with the right namespace.
>
> I picked up the trick on how to do it from Schematron.
> Whether Felix and Yves find it equally easy in their setups I look  
> forward to hearing.
> --
> Sebastian Rahtz
> Information Manager, Oxford University Computing Services
> 13 Banbury Road, Oxford OX2 6NN. Phone +44 1865 283431
>
> OSS Watch: JISC Open Source Advisory Service http://www.oss-watch.ac.uk
>
>
Received on Thursday, 2 February 2006 06:14:45 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:43:06 UTC