You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Simon Price <si...@bristol.ac.uk> on 2002/08/31 16:44:30 UTC

[SUMMARY] problems generating input to sql transformer with stylesheet (a la Langham & Ziegeler book)

Adding this line to the stylesheet fixes the bug.

   <xsl:output method="text"/>

In fact the problem turned out to have absolutely nothing to do with the 
  sql transformer; the problem was earlier in the pipeline but was 
masked because the xml piped into the transformer appeared okay when 
inspected using a view. However, although it serializes and displays in 
the browser, any attempt to transform the subsequent xml that comes out 
of the stylesheet creates an error.

I only discovered this when I started shortening the pipeline and also 
found that if I cut+pasted the xml from the stylesheet transformation 
into a text file, it worked fine if loaded by a file generator and 
immediately piped into the sql transformer!

I assume its a bug in one of cocoon's components.

Go figure :-(

Simon

Simon Price wrote:

> Ah! That's good to know. I can't use Java 1.4.1 because of the old 
> Oracle 8i JDBC driver I'm using but I will try running it under cocoon 
> 2.0.3 to see if its a 2.1 bug.
> 
> Thanks again.
> 
> Simon
> 
> Koen Pellegrims wrote:
> 
>> oops, I just ran your example on my machine, and it ran like a charm :-s
>>
>> I must say I'm running tomcat 4.0.4, cocoon 2.0.3 on java 1.4.0...
>>
>> Koen
>>
>>
>>> -----Oorspronkelijk bericht-----
>>> Van: Simon Price [mailto:simon.price@bristol.ac.uk]
>>> Verzonden: vrijdag 30 augustus 2002 14:53
>>> Aan: cocoon-users@xml.apache.org
>>> Onderwerp: Re: problems generating input to sql transformer with
>>> stylesheet (a la Langham & Ziegeler book)
>>>
>>>
>>> Koen, thanks but I already tried this. The resultant xml using your
>>> stylesheet is...
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <user xmlns:xmlns:sql="http://apache.org/cocoon/SQL/2.0">
>>>   <xmlns="http://apache.org/cocoon/SQL/2.0">
>>>     <>
>>>       <>ecsnp</>
>>>       <>Price</>
>>>       <>Simon</>
>>>     </>
>>>   </>
>>> </user>
>>>
>>> It sort of works but, for some reason, the rowset, row and column name
>>> tags get omitted by the sql transformer!!!
>>>
>>> In case it helps anyone say why this is, here's the intermediate xml
>>> from the stylesheet, before it goes into the sql transformer...
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <user xmlns:sql="http://apache.org/cocoon/SQL/2.0">
>>>   <sql:execute-query>
>>>     <sql:use-connection>pool-TAL</sql:use-connection>
>>>     <sql:query>
>>>       select
>>>         USERNAME,
>>>         SURNAME,
>>>         INITIALS
>>>       from
>>>         STAFF
>>>       where
>>>         STAFFID = '24'
>>>      </sql:query>
>>>   </sql:execute-query>
>>> </user>
>>>
>>> Koen Pellegrims wrote:
>>>
>>>
>>>> try your stylesheet as follows:
>>>>
>>>> <?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>
>>>>        <sql:execute-query>
>>>>          <sql:use-connection>pool-TAL</sql:use-connection>
>>>>          <sql:query>
>>>>            select
>>>>              USERNAME,
>>>>              SURNAME,
>>>>              INITIALS
>>>>            from
>>>>              STAFF
>>>>            where
>>>>              STAFFID = '24'
>>>>          </sql:query>
>>>>        </sql:execute-query>
>>>>      </user>
>>>>    </xsl:template>
>>>> </xsl:stylesheet>
>>>>
>>>> this is exactly the same approach you would take to generate fo, for
>>>> example.
>>>>
>>>> Koen.
>>>>
>>>>
>>>>
>>>>> -----Oorspronkelijk bericht-----
>>>>> Van: Simon Price [mailto:simon.price@bristol.ac.uk]
>>>>> Verzonden: vrijdag 30 augustus 2002 13:03
>>>>> Aan: cocoon-users@xml.apache.org
>>>>> Onderwerp: problems generating input to sql transformer with 
>>>>> stylesheet
>>>>> (a la Langham & Ziegeler book)
>>>>>
>>>>>
>>>>> 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:     <co...@xml.apache.org>
>>>>> For additional commands, e-mail:   <co...@xml.apache.org>
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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:     <co...@xml.apache.org>
>>>> For additional commands, e-mail:   <co...@xml.apache.org>
>>>>
>>>
>>> -- 
>>>
>>> -------------------------------------------------------------------
>>> 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:     <co...@xml.apache.org>
>>> For additional commands, e-mail:   <co...@xml.apache.org>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> 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:     <co...@xml.apache.org>
>> For additional commands, e-mail:   <co...@xml.apache.org>
>>
> 
> 


-- 

-------------------------------------------------------------------
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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>