You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Lars Huttar <la...@sil.org> on 2004/01/05 21:59:09 UTC

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


Re: bug: logicsheet not invoked unless namespace declaration is on the document element?

Posted by Joerg Heinicke <jo...@gmx.de>.
On 05.01.2004 21:59, Lars Huttar wrote:


> 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.

Yes, same opinion here.

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

I would call it a bug. Please add it to Bugzilla - and provide a patch 
if you can :)

> 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!)

I don't think the transformation itself fails - it's not even called. 
It's a problem of Cocoon itself, but don't ask me about internals.

Joerg


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