You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Yves Vindevogel <yv...@implements.be> on 2005/06/18 21:57:27 UTC

Duplicate namespace in SQL transformer

Hi,

I have a very simple page in XSL that I put through the SQL transformer.

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:param name="dir"/>
	<xsl:param name="file"/>
	
	<xsl:template match="/">
		<report>
			<xsl:variable name="doc">../reports/<xsl:value-of 
select="$dir"/>/<xsl:value-of select="$file"/>.xml</xsl:variable>
			
			<layout>			
				<xsl:copy-of select="document($doc)/report/*[name()!='query']"/>
			</layout>
			
			<dashboard>
				<execute-query xmlns="http://apache.org/cocoon/SQL/2.0">
       				<query>
       					select * from tblDashboard
       				</query>
     				</execute-query>
			</dashboard>
		</report>
	</xsl:template>
</xsl:stylesheet>


However, I get an error:
XML Parsing Error: duplicate attribute

The output in my browser is this, so it's logical that the error occurs.
<dashboard><rowset xmlns="http://apache.org/cocoon/SQL/2.0" 
xmlns="http://apache.org/cocoon/SQL/2.0"><row>


I need to add the namespace, or otherwise my query is not executed.
However, it appearing twice is killing my XML ...

Any solution ??


Met vriendelijke groeten,
Bien à vous,
Kind regards,

Yves Vindevogel
Implements


Re: Duplicate namespace in SQL transformer

Posted by Andrew Franz <af...@optushome.com.au>.
Yves Vindevogel wrote:

...
> 
> Second problem I have is how to declare the connection to use
> The link is something like this myreport.xsp?dbase=thisDatabase
> My connection is then thisDatabase where for another client that name is 
> different.
> I was able to do that in XSP, because the connection is declared there, 
> but in my transformer it's declared in the sitemap.

Have you tried this?

<map:transform type="sql">
	<map:parameter
		name="use-connection"
		value="{request-param:thisDatabase}" />
	...
</map:transform>

> 
...


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Duplicate namespace in SQL transformer

Posted by Yves Vindevogel <yv...@implements.be>.
Yes, I have.
If I don't put it on the execute-query part, it is not transformed.

My problem is this:

I have an XML file containing the query and the layout.
I must include this query in my pipeline somewhere.

I started out with XSP, to run it from there, but the query was defined  
on the database with a view.
That causes some problems (indexing, sorting in views) so I must run  
the query not on the database.
However, my XSP is a bit complicated.  I do not want to copy all my XSP  
code into every page.
In case of a code change, I have to much work.  Therefore, I was going  
to use the Transformer.
But that gives me the problem above.

Second problem I have is how to declare the connection to use
The link is something like this   myreport.xsp?dbase=thisDatabase
My connection is then   thisDatabase where for another client that name  
is different.
I was able to do that in XSP, because the connection is declared there,  
but in my transformer it's declared in the sitemap.

That's why I asked about the Document() function too.  I could write my  
single XSP file, and read the query from another file.
Maybe I could do this with an cocoon:mypage.xsp type of source ?

On 18 Jun 2005, at 22:46, Geert Josten wrote:

> Just a lucky guess, but have you tried putting the default namespace  
> decl on a different element? dashboard or even xsl:stylesheet?
>
> HTH,
> Geert
>
> Yves Vindevogel wrote:
>
>> Hi,
>> I have a very simple page in XSL that I put through the SQL  
>> transformer.
>> <?xml version="1.0" encoding="ISO-8859-1"?>
>> <xsl:stylesheet version="1.0"  
>> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>> <xsl:param name="dir"/>
>> <xsl:param name="file"/>
>> <xsl:template match="/">
>> <report>
>> <xsl:variable name="doc">../reports/<xsl:value-of  
>> select="$dir"/>/<xsl:value-of select="$file"/>.xml</xsl:variable>
>> <layout>
>> <xsl:copy-of select="document($doc)/report/*[name()!='query']"/>
>> </layout>
>> <dashboard>
>> <execute-query xmlns="http://apache.org/cocoon/SQL/2.0">
>> <query>
>> select * from tblDashboard
>> </query>
>> </execute-query>
>> </dashboard>
>> </report>
>> </xsl:template>
>> </xsl:stylesheet>
>> However, I get an error:
>> XML Parsing Error: duplicate attribute
>> The output in my browser is this, so it's logical that the error  
>> occurs.
>> <dashboard><rowset xmlns="http://apache.org/cocoon/SQL/2.0"  
>> xmlns="http://apache.org/cocoon/SQL/2.0"><row>
>> I need to add the namespace, or otherwise my query is not executed.
>> However, it appearing twice is killing my XML ...
>> Any solution ??
>> Met vriendelijke groeten,
>> Bien à vous,
>> Kind regards,
>> *Yves Vindevogel*
>> *Implements*
>> Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91
>> Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76
>> Web: http://www.implements.be
>> /
>> First they ignore you. Then they laugh at you. Then they fight you.  
>> Then you win.
>> Mahatma Ghandi./
>> ---------------------------------------------------------------------- 
>> --
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>
> -- 
> =====================================
> NB: het Daidalos kantoor is sinds 22 april
> jl. gevestigd op een nieuw adres:
>
> Daidalos BV
> Hoekeindsehof 1 - 4
> 2665 JZ Bleiswijk
> tel: +31 (0)10 850 12 00
> fax: +31 (0)10 850 11 99
>
> Bovenstaand adres is tevens het postadres.
> ======================
> Geert.Josten@Daidalos.nl
> IT-consultant at Daidalos BV
>
> http://www.daidalos.nl/
>
> GPG: 1024D/12DEBB50
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
Met vriendelijke groeten,
Bien à vous,
Kind regards,

Yves Vindevogel
Implements


Re: Duplicate namespace in SQL transformer

Posted by Geert Josten <Ge...@daidalos.nl>.
Just a lucky guess, but have you tried putting the default namespace decl on a different element? 
dashboard or even xsl:stylesheet?

HTH,
Geert

Yves Vindevogel wrote:

> Hi,
> 
> I have a very simple page in XSL that I put through the SQL transformer.
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xsl:stylesheet version="1.0" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:param name="dir"/>
> <xsl:param name="file"/>
> 
> 
> <xsl:template match="/">
> <report>
> <xsl:variable name="doc">../reports/<xsl:value-of 
> select="$dir"/>/<xsl:value-of select="$file"/>.xml</xsl:variable>
> 
> 
> <layout>
> <xsl:copy-of select="document($doc)/report/*[name()!='query']"/>
> </layout>
> 
> 
> <dashboard>
> <execute-query xmlns="http://apache.org/cocoon/SQL/2.0">
> <query>
> select * from tblDashboard
> </query>
> </execute-query>
> </dashboard>
> </report>
> </xsl:template>
> </xsl:stylesheet>
> 
> 
> However, I get an error:
> XML Parsing Error: duplicate attribute
> 
> The output in my browser is this, so it's logical that the error occurs.
> <dashboard><rowset xmlns="http://apache.org/cocoon/SQL/2.0" 
> xmlns="http://apache.org/cocoon/SQL/2.0"><row>
> 
> 
> I need to add the namespace, or otherwise my query is not executed.
> However, it appearing twice is killing my XML ...
> 
> Any solution ??
> 
> 
> Met vriendelijke groeten,
> Bien à vous,
> Kind regards,
> 
> *Yves Vindevogel*
> *Implements*
> 
> 
> 
> 
> Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91
> 
> Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76
> 
> Web: http://www.implements.be
> /
> First they ignore you. Then they laugh at you. Then they fight you. Then 
> you win.
> Mahatma Ghandi./
> 
> 
> ------------------------------------------------------------------------
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org

-- 
=====================================
NB: het Daidalos kantoor is sinds 22 april
jl. gevestigd op een nieuw adres:

Daidalos BV
Hoekeindsehof 1 - 4
2665 JZ Bleiswijk
tel: +31 (0)10 850 12 00
fax: +31 (0)10 850 11 99

Bovenstaand adres is tevens het postadres.
======================
Geert.Josten@Daidalos.nl
IT-consultant at Daidalos BV

http://www.daidalos.nl/

GPG: 1024D/12DEBB50

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Duplicate namespace in SQL transformer

Posted by Yves Vindevogel <yv...@implements.be>.
Hmm, that seems to work indeed.  When I prefix everything with sql and 
I include it as a namespace, it works.
Thanks a lot !!


On 19 Jun 2005, at 18:01, Askild Aaberg Olsen wrote:

> Yves Vindevogel wrote:
>
>> <dashboard>
>> <execute-query xmlns="http://apache.org/cocoon/SQL/2.0">
>> <query>
>> select * from tblDashboard
>> </query>
>> </execute-query>
>> </dashboard>
>> </report>
>> </xsl:template>
>> </xsl:stylesheet>
>
> Did you try with a prefix instead of a default namespace?
> Like:
>
> <sql:execute-query xmlns:sql="http://apache.org/cocoon/SQL/2.0">
> <sql:query>
> select * from tblDashboard
> </sql:query>
> </sql:execute-query>
>
> Askild
> -
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
Met vriendelijke groeten,
Bien à vous,
Kind regards,

Yves Vindevogel
Implements


Re: Duplicate namespace in SQL transformer

Posted by Askild Aaberg Olsen <as...@xangeli.com>.
Yves Vindevogel wrote:

> <dashboard>
> <execute-query xmlns="http://apache.org/cocoon/SQL/2.0">
> <query>
> select * from tblDashboard
> </query>
> </execute-query>
> </dashboard>
> </report>
> </xsl:template>
> </xsl:stylesheet>

Did you try with a prefix instead of a default namespace?
Like:

<sql:execute-query xmlns:sql="http://apache.org/cocoon/SQL/2.0">
<sql:query>
select * from tblDashboard
</sql:query>
</sql:execute-query>

Askild
-

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org