You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Manuel Mata <ma...@yahoo.es> on 2003/11/12 11:18:56 UTC
Problems with Views and SQLTransformer - A Bug ?
Hi i have a little problem using Views and
SQLTransformer. Maybe its a bug ? .I'm reading the
book 'Cocoon Developers Handbook' and its a sample
from that book at the chapter 10 section
SQLTransformer, so if one of you have the book may can
see it. Here is my code and problem.
I have this view in my sitemap to see raw XML data in
the IExplorer:
<map:view from-label="xml" name="xml">
<map:serialize type="xml"/>
</map:view>
It works fine.
And the pipeline:
<map:match pattern="tickets.html">
<map:generate type="file"
src="content/tickets.xml"/>
<map:transform type="sql" label="xml">
<map:parameter name="use-connection" value="abc"/>
</map:transform>
<map:transform type="xslt" src="style/tickets.xsl"/>
<map:serialize type="html"/>
</map:match>
The file tickets.xml:
<?xml version="1.0"?>
<page xmlns:sql="http://apache.org/cocoon/SQL/2.0">
<title>Trouble tickets for BigCorp</title>
<content>
<execute-query
xmlns="http://apache.org/cocoon/SQL/2.0">
<query>select * from TroubleTickets where
Customer='BigCorp' order by TicketOpened</query>
</execute-query>
</content>
</page>
And the file tickets.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="/page">
<html>
<head>
<title><xsl:value-of select="title"/></title>
<link rel="stylesheet" type="text/css"
href="style/index.css"/>
</head>
<body>
<xsl:apply-templates/>
<br/><br/><a href="">Home page</a>
</body>
</html>
</xsl:template>
<xsl:template match="title">
<h3 align="center"><xsl:apply-templates/></h3>
</xsl:template>
<xsl:template match="sql:rowset">
<table border="1">
<xsl:apply-templates/>
</table>
</xsl:template>
<xsl:template match="sql:row">
<tr>
<xsl:for-each select="*">
<td>
<xsl:apply-templates/>
</td>
</xsl:for-each>
</tr>
</xsl:template>
</xsl:stylesheet>
Here is all the code we need.
I use the URI
http://localhost:8080/cocoon/abc/tickets.html and it
all works fine !!!. I get the query in an beautiful
html table.
But note that in the pipeline there is a 'label=xml'
attribute so when i use the URI
http://localhost:8080/cocoon/abc/tickets.html?cocoon-view=xml
to see the raw xml data generated by the
SQLTransformer i get an error.
The error is that the xml formed has a duplicate
attribute in the <rowset> tag. The duplicate attribute
is xmlns="http://apache.org/cocoon/SQL/2.0".
So i dont understand why it works in the pipeline so
duplicated attributes are not allowed in XML and when
i use the view the IExplorer cant show it.
Anyway it works but I'd like to solve this to debug
viewing the XML data returned from the SQLTransformer.
Thx.
___________________________________________________
Yahoo! Messenger - Nueva versión GRATIS
Super Webcam, voz, caritas animadas, y más...
http://messenger.yahoo.es
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Problems with Views and SQLTransformer - A Bug ?
Posted by Manuel Mata <ma...@yahoo.es>.
> It seems indeed to be a bug, but I don't know where
> - the SQLTransformer?
Yeah. Note that the 'label="xml"' is on the
<map:transform type="sql" label="xml"/> step of the
pipeline. I tried on the previous and next steps and
it works fine.
> And you are not the first one having
> this problem with
> the duplicate namespace declaration.
Sorry i only used the new users mail-list before. I
found a mail on the old cocoon-users mail list with
the same problem from 11 months ago but has no
responses. I'll send a mail to its author anyway.
> This behaviour
> seems to be fixed
> through the transformation step. Something that's
> important for finding
> the bug: The error cames only in IE when it tries to
> display the file,
> i.e. not already on server side?
Yeah the server works. Is the IExplorer who makes the
error displaying the XML file.
> If yes, is the
> namespace declaration
> also duplicate in the resulting HTML file?
Ye when i use the 'View/Source code' from the
IExplorer I get the following code:
<?xml version="1.0" encoding="UTF-8"?>
<page xmlns:sql="http://apache.org/cocoon/SQL/2.0">
<title>Trouble tickets for BigCorp</title>
<content>
<rowset xmlns="http://apache.org/cocoon/SQL/2.0"
xmlns="http://apache.org/cocoon/SQL/2.0">
<row>
...
</row>
</rowset>
</content>
</page>
So a bug ? We'll see. Thx everybody.
___________________________________________________
Yahoo! Messenger - Nueva versión GRATIS
Super Webcam, voz, caritas animadas, y más...
http://messenger.yahoo.es
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Problems with Views and SQLTransformer - A Bug ?
Posted by Joerg Heinicke <jh...@virbus.de>.
On 12.11.2003 11:18, Manuel Mata wrote:
> Hi i have a little problem using Views and
> SQLTransformer. Maybe its a bug ? .I'm reading the
> book 'Cocoon Developers Handbook' and its a sample
> from that book at the chapter 10 section
> SQLTransformer, so if one of you have the book may can
> see it. Here is my code and problem.
>
> I have this view in my sitemap to see raw XML data in
> the IExplorer:
<snip what="code"/>
> Here is all the code we need.
> I use the URI
> http://localhost:8080/cocoon/abc/tickets.html and it
> all works fine !!!. I get the query in an beautiful
> html table.
> But note that in the pipeline there is a 'label=xml'
> attribute so when i use the URI
> http://localhost:8080/cocoon/abc/tickets.html?cocoon-view=xml
> to see the raw xml data generated by the
> SQLTransformer i get an error.
> The error is that the xml formed has a duplicate
> attribute in the <rowset> tag. The duplicate attribute
> is xmlns="http://apache.org/cocoon/SQL/2.0".
> So i dont understand why it works in the pipeline so
> duplicated attributes are not allowed in XML and when
> i use the view the IExplorer cant show it.
>
> Anyway it works but I'd like to solve this to debug
> viewing the XML data returned from the SQLTransformer.
It seems indeed to be a bug, but I don't know where - the
SQLTransformer? And you are not the first one having this problem with
the duplicate namespace declaration. This behaviour seems to be fixed
through the transformation step. Something that's important for finding
the bug: The error cames only in IE when it tries to display the file,
i.e. not already on server side? If yes, is the namespace declaration
also duplicate in the resulting HTML file?
Joerg
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org