cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Perry Tew <perry_...@yahoo.com>
Subject Re: Cocoon2: Bug in sql transformer? -repost with missing content
Date Wed, 07 Nov 2001 17:30:14 GMT
Sorry about sending a blank email.  Hit the return key by accident.

I'm reposting a previous problem in a more general fashion.
It's the stangest thing.  
When I use a static xml file as my generate src, this works:  
<template match="rowset[@name]">
BUT, when I use the sql transformer, and then transform the xml into
html, it doesn't work and I have to use <template match="rowset[@*]">
instead.  I can't understand why [@name] works for static xml and not
the sql transformer.

Would somebody please look at this and assure me I'm not going mad?
I wrote the simplest query and xsl sheet I could, and I've included
them below.  Also, at the end, I've included the raw xml from the sql
transform.  Any help is greatly appreciated.

Thanks,
Perry Tew

Here's what I've done:

==========sitemap.xmap==============
<map:match pattern="short_test.html">
    <map:generate src="atp_short.xml"/>
    <map:transform type="sql">
        <map:parameter name="use-connection" value="orcl"/>
    </map:transform>
    <map:transform src="atp_short.xsl"/>
    <map:serialize type="html"/>
</map:match>
=========end sitemap.xmap===========

==========atp_short.xml==============
<?xml version="1.0"?>
<page xmlns:sql="http://apache.org/cocoon/SQL/2.0">
    <execute-query xmlns="http://apache.org/cocoon/SQL/2.0"> 
        <query name="report_date"> SELECT SYSDATE FROM DUAL </query>
    </execute-query>
</page>
==========end atp_short.xml==========


==========atp_short.xsl that works==============
<?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="/">
    <xsl:apply-templates/>
</xsl:template>

<xsl:template match="page">
    <html>
        <body>
            <h4>Found page match</h4>
            <xsl:apply-templates/>
        </body>
    </html>
</xsl:template>
<!--
   NOTICE the @* instead of the @name???
-->
<xsl:template match="sql:rowset[@*]">
    <h4>Found rowset match</h4>
    <xsl:for-each select="@*">
        <h4>
        <xsl:text>attribute=</xsl:text>
        <xsl:value-of select="name()"/><br/>
        <xsl:text>value=</xsl:text>
        <xsl:value-of select="."/>
        </h4>
    </xsl:for-each>
</xsl:template>
</xsl:stylesheet>
==========end atp_short.xsl that works==========

==========atp_short.xsl that DOES NOT work==============
<?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="/">
    <xsl:apply-templates/>
</xsl:template>

<xsl:template match="page">
    <html>
        <body>
            <h4>Found page match</h4>
            <xsl:apply-templates/>
        </body>
    </html>
</xsl:template>

<!--
   NOTICE THE @name... that's what's not working
-->
<xsl:template match="sql:rowset[@name]">
    <h4>Found rowset match</h4>
    <xsl:for-each select="@*">
        <h4>
        <xsl:text>attribute=</xsl:text>
        <xsl:value-of select="name()"/><br/>
        <xsl:text>value=</xsl:text>
        <xsl:value-of select="."/>
        </h4>
    </xsl:for-each>
</xsl:template>
</xsl:stylesheet>
==========end atp_short.xsl that DOES NOT work==========



===========output from the first xsl sheet (that works)======
<html xmlns:sql="http://apache.org/cocoon/SQL/2.0">
<body>
<h4>Found page match</h4>
	 
		
	
<h4>Found rowset match</h4>
<h4>attribute=name<br>value=report_date</h4>

</body>
</html>
===========end output from the first xsl sheet (that works)======



===========output from the second xsl sheet (does not work)======
<html xmlns:sql="http://apache.org/cocoon/SQL/2.0">
<body>
<h4>Found page match</h4>
	 
		
	2001-11-07 12:17:38.0
</body>
</html>
===========end output from the second xsl sheet (does not work)======



==============raw xml from sql transformer========================
<?xml version="1.0" encoding="UTF-8" ?> 
<page xmlns:sql="http://apache.org/cocoon/SQL/2.0">
    <rowset name="report_date"
xmlns="http://apache.org/cocoon/SQL/2.0">
        <row>
            <sysdate>2001-11-07 12:23:49.0</sysdate> 
        </row>
    </rowset>
</page>

__________________________________________________
Do You Yahoo!?
Find a job, post your resume.
http://careers.yahoo.com

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.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