You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by ja...@petrobras.com.br on 2003/09/01 17:04:24 UTC

Re: Is Xalan processing a DOMSource correctly?

I don't think this is not really a XPath problem, but just a question of
how a DOMSource should behave. And this is quite clear -- it should behave
like a Source, no matter which Node was use to construct it. It seems
Xalan's DOMSource implemantation is a bit naïve regarding this, relying too
much on Document/DocumentFragment implementations when it comes to the root
node. The fact that, from the transform XPath point of view, a root node
has no name, does not mean a named Element cannot be used to construct the
DOMSource -- the processor is free to ignore the element name, since it is
not needed anyway. If Xalan's implementation is somehow dependent on the
root node type, this should be hidden inside DOMSource, not exposed the the
class client.
=============================================
Marcelo Jaccoud Amaral
Petrobras - TI - Negócios Eletrônicos
mailto:jaccoud [at] petrobras.com.br
=============================================
There are only 10 kinds of people in the world: those who understand binary
and those who don't.



                                                                                                            
                      "Henry Zongaro"                                                                       
                      <zongaro@ca.ibm.c        Para:     xalan-dev@xml.apache.org                           
                      om>                      cc:       (cco: Marcelo Jaccoud Amaral/RJ/Petrobras)         
                                               Assunto:  Re: Is Xalan processing a DOMSource correctly?     
                      2003-08-30 08:50                                                                      
                      Favor responder a                                                                     
                      xalan-dev                                                                             
                                                                                                            
                                                                                                            




Hello,

     I'm not entirely sure which reading of the specification is correct.
There have been earlier bug reports [1-3] related to this, and I'm not
sure that any satisfactorily answers this question.  I will submit the
question to the JAXP Expert Group for consideration.

     It should be noted that XPath 1.0 describes some semantics for root
nodes that certainly make it sound like the root in the XPath data model
is a special kind of node, distinct from other kinds of nodes, such as
elements.  For instance, section 5.1 [4] states that "The root node does
not have an expanded name," which is not true of, say, element nodes.  The
XPath 1.0 Errata document [5] describes the root node as corresponding "to
the unique document information item in an XML Information Set."  Again, an
element that is at the root of a DOM doesn't seem to fit that
description.

     In addition, the most recently published version of the DOM Level 3
Core Working Draft Specification describes the mapping between DOM and
Info-set in appendix C [6].  That indicates that "A Document node maps to
an document information item."  However, it doesn't say anything about
DocumentFragment.

     In some sense we're falling between the cracks of specifications
here, because we're dealing with trees that do not describe complete
documents.

Thanks,

Henry
[1] http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4995
[2] http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12270
[3] http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17979
[4] http://www.w3.org/TR/xpath#root-node
[5] http://www.w3.org/1999/11/REC-xpath-19991116-errata/
[6]
http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030609/infoset-mapping.html#Document2Infoset

------------------------------------------------------------------
Henry Zongaro      Xalan development
IBM SWS Toronto Lab   T/L 969-6044;  Phone +1 905 413-6044
mailto:zongaro@ca.ibm.com




jaccoud@petrobras.com.br
2003-08-29 09:59 AM
Please respond to xalan-dev


        To:     xalan-dev@xml.apache.org
        cc:
        Subject:        Is Xalan processing a DOMSource correctly?



Greetings.

I have discussed this issue in the users group with Mr. Flanagan but
haven't got to a conclusion. We disagree as to specs interpretation.

The DOMSource description states that any node with a subtree can be used
as a root node (root meaning the XPath definition or "/"). In a current
application, however, I discovered that Xalan is not calling the root
template (<template match="/">) except when the root node is a Document or
a DocumentFragment. When providing a Element as root node, Xalan does not
call the root tamplate, but call a template matching the document element
instead -- it should not, the document element template should only be
called by the (provided or default) root template.
I saw nothing in the XPath that demands that the root node is a DOM
Document[Fragment] object, nor DOMSource docs state so. I also cannot see
any technical reason for limiting the root node type, since it is not used
by itself, it is only a starting point for expressions that begin with
"/".

Can you please verify the conformity of this behaviour and my asuumptions?
I don't think Xalan should act as thus, but instead should call the root
template independently of the root node type (and *not* call the children
templates if my stylesheet defines a root template).

Thanks.