cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 26107] New: - Logic sheet docs fail to mention that namespaces must be declared at top level
Date Tue, 13 Jan 2004 21:04:29 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26107>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26107

Logic sheet docs fail to mention that namespaces must be declared at top level

           Summary: Logic sheet docs fail to mention that namespaces must be
                    declared at top level
           Product: Cocoon 2
           Version: 2.1
          Platform: Other
               URL: http://cocoon.apache.org/2.1/userdocs/xsp/logicsheet.htm
                    l
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Documentation
        AssignedTo: dev@cocoon.apache.org
        ReportedBy: lars@huttar.net


The XSP Logicsheet Guide,
http://cocoon.apache.org/2.1/userdocs/xsp/logicsheet.html, tells us that the
namespaces of logicsheets used in an XSP page must be declared in the XSP page
file. ("To use the request taglib, you must declare the request namespace in
your XSP file:") What it doesn't specify is that they must be declared on the
xsp:page element itself. (At least, I think this is true because of the behavior
I'm observing.)
Actually, this is not an ideal state of affairs, because according to the XML
Namespaces spec, the actual location of namespace declarations should be
transparent to applications; all that should matter is what namespace-uri any
given element or attribute is in. Because of this mismatch, it is not
straightforward to generate an XSP page that uses a logicsheet; to force a
namespace declaration to appear on the xsp:page element, one has to resort to
creating dummy attributes. I've tried to think of a way to change the way this
*should* be specified without breaking old logicsheets, but I haven't come up
with anything at this point.

Anyway, regarding the logicsheet behavior that leads me to believe logicsheet
namespaces have to be declared on the xsp:page element in order to be effective,
here is an email I sent to cocoon user list.

> Sent: Mon 1/5/2004 2:59 PM
> Subject: bug: logicsheet not invoked unless namespace declaration is on the
document element?

Dear Cocooners,

Running Cocoon 2.1.2, we have the following XSP page:

<?xml version="1.0" encoding="UTF-8"?>
<xsp:page language="java" xmlns:xsp="http://apache.org/xsp">
  <select-page>
    <entity>Ethnologue Country</entity>
    <list role="instances">
      <sil:query connection="ethnolog" row-element="link"
xmlns:sil="http://www.sil.org/namespace/xsp-query">SELECT Ethnologue_Country_Id id,
Ethnologue_Country_Lb label FROM Ethnologue_Country_admin WHERE Parent_Id IS
NULL</sil:query>
    </list>
  </select-page>
</xsp:page>

This page uses the "sil" logicsheet, declared in cocoon.xconf.

When used as above, the SIL logicsheet does not seem to get invoked;
the output of the page is the same as its content, except that xsp:page
is removed:

  <select-page>
    <entity>Ethnologue Country</entity>
    <list role="instances">
      <sil:query connection="ethnolog" row-element="link"
xmlns:sil="http://www.sil.org/namespace/xsp-query">SELECT Ethnologue_Country_Id id,
Ethnologue_Country_Lb label FROM Ethnologue_Country_admin WHERE Parent_Id IS
NULL</sil:query>
    </list>
  </select-page>

However, if I move the sil namespace declaration from the sil:query
element to the xsp:page element, as follows:

<?xml version="1.0" encoding="UTF-8"?>
<xsp:page language="java" xmlns:xsp="http://apache.org/xsp"
xmlns:sil="http://www.sil.org/namespace/xsp-query">
  <select-page>
    <entity>Ethnologue Country</entity>
    <list role="instances">
      <sil:query connection="ethnolog" row-element="link">SELECT
Ethnologue_Country_Id id,
Ethnologue_Country_Lb label FROM Ethnologue_Country_admin WHERE Parent_Id IS
NULL</sil:query>
    </list>
  </select-page>
</xsp:page>

then the XSP page works, producing data such as

<select-page>
  <entity>Ethnologue Country</entity>
  <list role="instances">
    <link>
      <ID>35</ID>
      <LABEL>Cambodia</LABEL>
    </link>
    ...

!

If I'm not mistaken, the above change shouldn't make any difference
to a namespace-aware XML application; no element is in a different
namespace than it was before. Nevertheless this seems to be making
a crucial difference to the logicsheet processor.

This is significant because this XSP page is generated by a stylesheet;
it's not very easy to force the generated code to have the sil
namespace declaration on the xsp:page element rather than on
the sil:query element, since the latter is the only place it's needed.

Am I missing something, or is this indeed a bug?

Thanks,
Lars


P.S. The logicsheet begins like this:

<xsl:stylesheet version="1.0"
	  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
       xmlns:xsp="http://apache.org/xsp"
       xmlns:sil="http://www.sil.org/namespace/xsp-query"
       xmlns:esql="http://apache.org/cocoon/SQL/v2">

  <xsl:output indent="yes" method="xml" />

  <xsl:template match="sil:query">

so this template should match any <sil:query> that's in the
right namespace, regardless of whether the namespace declaration
occurs on the <sil:query> element itself, or an ancestor.
(In fact the XSL processor shouldn't even know the difference!)


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org

[end of email quote]

Of course, it may be decided that the documentation is right,
and the logicsheet behavior is wrong. That would be fine with me!

Mime
View raw message