cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Price <simon.pr...@bristol.ac.uk>
Subject problems generating input to sql transformer with stylesheet (a la Langham & Ziegeler book)
Date Fri, 30 Aug 2002 11:02:59 GMT
I'm having real problems doing a "trivial" tranformation (in the style 
of Matthew and Carsten's excellent book).

I generate xml which then gets transformed by the sql transformer. 
Unfortunately, it only works if I have no containing elements in the 
input to the transformer. I'm guessing its related to the namespace? Or 
is it a bug in the sql transformer? Any suggestions welcomed!

Here's the full details (stripped down to simplest repro so please don't 
worry about the stylesheet now being pointless)...


version info:

tomcat 4.0.1
java 1.3.1
cocoon 2.1 head


sitemap fragment:

       <map:match pattern="test3.xml">
         <map:generate src="model/bootstrap.xml"/>
         <map:transform src="model/staff_model.xsl"/>
         <map:transform type="sql"/>
         <map:serialize type="xml"/>
       </map:match>


model/bootstrap.xml:

<?xml version="1.0"?>
<bootstrap/>


model/staff_model.xsl

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:sql="http://apache.org/cocoon/SQL/2.0">
   <xsl:template match="bootstrap">
     <user>
       <execute-query xmlns="http://apache.org/cocoon/SQL/2.0">
         <use-connection>pool-TAL</use-connection>
         <query>
           select
             USERNAME,
             SURNAME,
             INITIALS
           from
             STAFF
           where
             STAFFID = '24'
         </query>
       </execute-query>
     </user>
   </xsl:template>
</xsl:stylesheet>


error in browser (reformatted by hand to make more readable):

Multiple colons are not allowed in a name. Error processing resource 
'http://localhost:8080/cocoon/tal/admin/test3.xml'. Line 2, Position 18

<user xmlns:xmlns:sql="http://apache.org/cocoon/SQL/2.0">
  -----------------^
   <rowset xmlns="http://apache.org/cocoon/SQL/2.0" 
xmlns:sql="http://apache.org/cocoon/SQL/2.0">
     <row>
       <username>ecsnp</username>
       <surname>Price</surname>
       <initials>S</initials>
     </row>
   </rowset>
</user>

To help diagnose, the intermediate XML that comes out of the stylesheet 
transformation, before going into the sql transformer is:

   <?xml version="1.0" encoding="UTF-8" ?>
   <user xmlns:sql="http://apache.org/cocoon/SQL/2.0">
   <execute-query xmlns="http://apache.org/cocoon/SQL/2.0">
   <use-connection>pool-TAL</use-connection>
   <query>select USERNAME, SURNAME, INITIALS from STAFF where STAFFID = 
'24'</query>
   </execute-query>
   </user>

Contrast this with the XML at the same point if the root <user> element 
is removed from the stylesheet (THIS ONE WORKS):

   <?xml version="1.0" encoding="UTF-8" ?>
   <execute-query xmlns="http://apache.org/cocoon/SQL/2.0" 
xmlns:sql="http://apache.org/cocoon/SQL/2.0">
   <use-connection>pool-TAL</use-connection>
   <query>select USERNAME, SURNAME, INITIALS from STAFF where STAFFID = 
'24'</query>
   </execute-query>


Thanks in advance

Simon

-------------------------------------------------------------------
Simon Price
Institute for Learning and Research Technology
University of Bristol
8-10 Berkeley Square
Bristol BS8 1HH
United Kingdom

Direct: +44 (0)7071 226 720
Office: +44 (0)117 928 7193
Fax: +44 (0)117 928 7112
Simon.Price@bristol.ac.uk
http://www.ilrt.bristol.ac.uk



---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

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


Mime
View raw message