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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]