You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Cedric Claus <ce...@u-mangate.com> on 2003/02/06 16:53:46 UTC

Problem with SQL Transformer

Hi,

I have a problem with a pipeline :

<map:match pattern="AOS/page1.html">
	<map:generate src="xml/page1.xml"/>
	<map:transform type="sql"/>
	<map:transform type="xslt" src="xsl/SortAndReplace.xsl"/>
	<map:transform type="xslt" src="xsl/HAbstract.xsl"/>
	<map:serialize/>
</map:match>

This pipeline doesn't work : After SQL transformation the sort and 
replace.xsl does wrong. But if I copy the xml result of the SQL 
transform and then apply the same xsl , no problem!!!! (with xalan and 
MSXML)


My configuration : cocoon 2.0  - tomcat 4.0.5 - JDK 1.4.03 et xalan 2.3.1

What 's wrong??? Is it in configuration??

thx for response

Ced

page1.xml:

<document>
	<elements>
		<element position="1" type="title">
			<text>Mon titre 1</text>
		</element>
		<element position="2" type="paragraphe">
			<text>c'est beau </text>
			<sql:execute-query xmlns:sql="http://apache.org/cocoon/SQL/2.0">
				<sql:use-connection>database_connection</sql:use-connection>
				<sql:query>select data from DataRessources where ( ID_fk_dataDesc=1 
and ID_fk_dataLangue=1 )</sql:query>
			</sql:execute-query>
		</element>
	</elements>
</document>
_______________________________________________________________________

SortAndReplace.xsl:

<xsl:template match="/">
	<document>
		<elements>
			<xsl:apply-templates select="document/elements"/>
		</elements>
	</document>
	
</xsl:template>


<xsl:template match="document/elements">
	
	<xsl:for-each select="element">
	<xsl:sort  select="@position"/>
		<element>
			<xsl:attribute name="type">
				<xsl:value-of select="@type"/>
			</xsl:attribute>
			<xsl:attribute name="position">
				<xsl:value-of select="@position"/>
			</xsl:attribute>
			<xsl:for-each select="text">
					<xsl:value-of select="."/>
					<xsl:if test="following-sibling::rowset">
						<xsl:apply-templates select="following::rowset/row/data"/>
					</xsl:if>
				
			</xsl:for-each>
		</element>
	
	</xsl:for-each>
</xsl:template>

<xsl:template match="rowset/row/data">
	<xsl:value-of select="."/>
</xsl:template>
</xsl:stylesheet>
____________________________________________________________________________



---------------------------------------------------------------------
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>


Re: Problem with SQL Transformer[Sol]

Posted by Cedric Claus <ce...@u-mangate.com>.
Martin Holz wrote:

>Cedric Claus <ce...@u-mangate.com> writes:
>  
>
>>This pipeline doesn't work : After SQL transformation the sort and
>>replace.xsl does wrong. But if I copy the xml result of the SQL
>>transform and then apply the same xsl , no problem!!!! (with xalan and
>>MSXML)
>>
>>
>>
>>My configuration : cocoon 2.0  - tomcat 4.0.5 - JDK 1.4.03 et xalan 2.3.1
>>
>>What 's wrong??? Is it in configuration??
>>    
>>
>
>Your configuration looks okay.
>
>If something goes wrong in pipeline, but works when copying
>the intermediate result, this is almost always a namespace
>problem. Namespace handling in SAX is sometimes strange
>(its even stranger in DOM). 
>The information in the "namespace" argument and 
>the localname argument of the method org.sax.ContentHandler.startElement
>should be redundant to the qname argument and calls to ContentHandler.startPrefixMapping.
>But if there is a bug somewhere in the pipeline, this might not be the case. The bug 
>might be undetected for a long time, because many components including the Serializer
>use only a part of the information. The XMLSerialzer has the tendency to silently
>correct a mismatch between the qname and the namespace.
>
>Carsten Ziegler fixed a bug in namespace handling of SQLTransformer at 2002/11/14
>cocoon 2.0 is older. Maybe you should try a  newer version of cocoon.
>
>
>Martin
>
> 
>  
>
It was really a problem with the namespace, I had changed my XSL depends 
on the Namespace and it does well!!!!

Thanks vm for your help

this is the modified file :


<xsl:for-each select="text">
                    <xsl:value-of select="."/>
                    <xsl:if test="following-sibling::sql:rowset">
                        <xsl:apply-templates 
select="following::sql:rowset/sql:row/sql:data"/>
                    </xsl:if>
....



---------------------------------------------------------------------
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>


Re: Problem with SQL Transformer

Posted by Martin Holz <ho...@fiz-chemie.de>.
Cedric Claus <ce...@u-mangate.com> writes:
> This pipeline doesn't work : After SQL transformation the sort and
> replace.xsl does wrong. But if I copy the xml result of the SQL
> transform and then apply the same xsl , no problem!!!! (with xalan and
> MSXML)
> 
> 
> 
> My configuration : cocoon 2.0  - tomcat 4.0.5 - JDK 1.4.03 et xalan 2.3.1
> 
> What 's wrong??? Is it in configuration??

Your configuration looks okay.

If something goes wrong in pipeline, but works when copying
the intermediate result, this is almost always a namespace
problem. Namespace handling in SAX is sometimes strange
(its even stranger in DOM). 
The information in the "namespace" argument and 
the localname argument of the method org.sax.ContentHandler.startElement
should be redundant to the qname argument and calls to ContentHandler.startPrefixMapping.
But if there is a bug somewhere in the pipeline, this might not be the case. The bug 
might be undetected for a long time, because many components including the Serializer
use only a part of the information. The XMLSerialzer has the tendency to silently
correct a mismatch between the qname and the namespace.

Carsten Ziegler fixed a bug in namespace handling of SQLTransformer at 2002/11/14
cocoon 2.0 is older. Maybe you should try a  newer version of cocoon.


Martin

 



---------------------------------------------------------------------
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>