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 2005/07/22 23:24:54 UTC

cinclude doesn't cinclude, only garbles its input

Dear Cocoonists,

We're getting strange results from cinclude. It's all the more baffling 
because cinclude works fine in many cases.
FYI we've tried this with Tomcat 4.1, Tomcat 5.5, and Jetty, and Cocoon 
2.1.2, 2.1.5.1, and 2.1.7. All give the same results.

When I run the troubled URL, 
"http://localhost:8888/mount/ethnologue/checks/list-tables", the browser 
gives an XML parsing error because the output from cinclude is not 
well-formed XML: most elements have no close tags!

If I do a view-source on the output of the cinclud transform, it looks 
like this:
<table xmlns:cinclude="http://apache.org/cocoon/include/1.0">
  <cinclude:include 
src="cocoon:/checks/count-rows?table=Development_Status">
    <cinclude:include 
src="cocoon:/checks/count-rows?table=Development_Type">
      ...
        <cinclude:include 
src="cocoon:/checks/count-rows?table=Writing_System"/>
(That's really the end!)
Note that only the last element is closed.
    
The pipeline in the sitemap:
      <map:match pattern="checks/list-tables">
        <map:generate src="sources/ethnologue-schema.xml"/>
        <!-- Generate cinclude statements for checks/count-rows from 
<table> elements. -->
        <map:transform src="transforms/list-tables-cinclude.xsl" 
label="raw"/>
        <!-- Process cinclude statements. -->
        <map:transform type="cinclude" label="raw2"/>
        <map:serialize type="xml"/>
      </map:match>

The data in the pipeline before the cinclude transformer 
(check/list-tables?cocoon-view=raw) looks like this:
<tables xmlns:cinclude="http://apache.org/cocoon/include/1.0">
  <cinclude:include 
src="cocoon:/checks/count-rows?table=Development_Status"/>
  <cinclude:include src="cocoon:/checks/count-rows?table=Development_Type"/>
  ...
  <cinclude:include src="cocoon:/checks/count-rows?table=Writing_System"/>
</tables>

In other words, the output of the cinclude transformer is the same as 
its input, except that each <cinclude:include> element becomes a child 
of the previous one. Or to put it another way, all the endElement events 
except one are dropped. There is no processing of the src URLs.
Incidentally, if you run the src URLs on their own, e.g. 
http://localhost/mount/ethnologue/checks/count-rows?table=Development_Status,
they run successfully and produce well-formed XML output:

<table [namespace declarations for xsp, xspdoc, esql, xsp-request]>
  <name>Development Status</name>
  <count>11875</count>
</table>

As I mentioned at the top, cinclude works fine for us in other applications.

Any ideas?

One interesting thing is that if we follow the cinclude transformer with 
an XSLT transformer that simply copies its input, that the XSLT 
transformer's output is
<table xmlns:cinclude="http://apache.org/cocoon/include/1.0">
  <cinclude:include 
src="cocoon:/checks/count-rows?table=Development_Status">
    <cinclude:include 
src="cocoon:/checks/count-rows?table=Development_Type">
      ...
        <cinclude:include 
src="cocoon:/checks/count-rows?table=Writing_System"/>
      ...
   </cinclude:include>
  </cinclude:include>
</table>

In other words, all the unclosed elements get closed. But still no 
indication of why they became children of each other, nor why the 
<cinclude:include> elements didn't get replaced with the output of their 
respective src pipelines.

Any help would be appreciated...
Lars



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