W3C home > Mailing lists > Public > xproc-dev@w3.org > November 2011

Re: XProc Usability (was Re: New to Xproc Question : conditionnal "output port" definition?)

From: Michael Sokolov <sokolov@ifactory.com>
Date: Thu, 03 Nov 2011 22:26:49 -0400
Message-ID: <4EB34D69.8060708@ifactory.com>
To: xproc-dev@w3.org
On 10/31/2011 1:30 PM, Norman Walsh wrote:
> Michael Sokolov<sokolov@ifactory.com>  writes:
>
>> The fact is that "names" in XML are context-sensitive and have
>> hidden parts to them which can only be detected by performing
>> tree-walking.
> That's not how I see it. Names in XML are a tuple and you need both
> halves. If you want to re-serialize and preserve prefixes, when
> possible, they're a triple. You do not have to walk around in the tree
> to find any "hidden parts". Unless, of course, you're getting a QName
>  From content, I suppose.
My point  is pretty simple: you (often) can't tell from looking at an 
element (in an XML text file with a simple text editor) what namespace 
that element is in.  You can usually guess, but you can't really tell 
for sure without chasing up the ancestor chain looking for namespace decls.
>> My main beef is about the lack of default-namespace
>> binding in XPath - it's totally counter-intutitive (at least once you've
>> absorbed how namespaces work everywhere else...)
> You haven't used XQuery have you? The most staggeringly awful bug in XQuery
> is the fact that the default namespace binding applies to XPath expressions.
> It makes code of the following form fail silently:
>
> let $x :=<nons><child>value</child></nons>
> return
>    <div xmlns="http://www.w3.org/1999/xhtml" class="{$x/child}"/>
That only "fails" by one definition ... I guess i internalized the 
xquery syntax first, and then got confused when xpath in xslt didn't 
work the same way.  Frankly I don't have a strong opinion about which 
one is better, but the inconsistency led me into a long period where I 
just wouldn't use default namespace declarations at all, in either xslt 
or xquery.  I'm more or less sticking to that now.

The other namespace abomination in xquery is that once you've declared a 
default namespace, it is very difficult to refer to elements with no 
namespace.  Marklogic used to allow a prefix assignment for this, but 
apparently it wasn't compatible with the standard?  So yet another 
reason not to fiddle with the default namespace.

-Mike
Received on Friday, 4 November 2011 02:27:32 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 4 November 2011 02:27:33 GMT