You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Chrisoula Alexandraki <ch...@ics.forth.gr> on 2001/11/23 13:38:25 UTC

[C2] preserving namespaces

Hello all.

I see there are a couple of messages referring to my problem but no
clear solution has been provided. So, I am afraid I shall have to bother
you anyway.


My question is: If a have a namespace that does not correspond to a
logicsheet, but is referenced by existing logicsheets, do I have to
declare it inside every logicsheet served by cocoon? 

In more detail: I have a logicsheet using the namespace prefix palio.

============================
So here is palio.xsl:
============================
<?xml version="1.0"?>

<xsl:stylesheet version="1.0" 	xmlns:xsp="http://apache.org/xsp"
				xmlns:util="http://apache.org/xsp/util/2.0" 											  			
				xmlns:palio="http://ics.forth.gr/palio"
				xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
				xmlns:ontology="http://ics.forth.gr/ontology">
...

<xsl:template match="palio:getInfo">

	<xsp:logic> String info = GISInvoker.getInstance().getInfo(
"<xsl:value-of select="."/>" ); </xsp:logic>  	
	
	<util:include-expr><util:expr><xsp:expr> info
</xsp:expr></util:expr></util:include-expr> 		

</xsl:template>

...
</xsl:stylesheet>

=======================


The string info returned by the java call contains:

<ontology:info><ontology:myname>Chrisoula</ontology:myname></ontology:info>

in other words an XML Sting with elements of xmlns ontology.
When running cocoon I get a 

=================================================
org.xml.sax.SAXParseException: The namespace prefix "ontology" was not
declared.
	at
org.apache.cocoon.components.parser.JaxpParser.error(JaxpParser.java:1
... 
===================================================

and  <palio:getInfo> returns an empty String, even if I
have declared xmlns:ontology="http://ics.forth.gr/ontology" both in the
logicsheet (palio.xsl), as well as the XML template calling it
(palio.xml).

I guess I should solve my problem by declaring the ontology namespace
also in util.xsl and xsp.xsl. Well, is there a smarter solution?
Something to declare in cocoon.xconf (such as a dummy logicsheet
ontology.xsl), or whatever?

Many thanks,
chrisoula


---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: [C2] preserving namespaces

Posted by Chrisoula Alexandraki <ch...@ics.forth.gr>.
Oh, sorry!
I have tried

<page xsp:ontology="http://ics.forth.gr/ontology">

like you are suggesting in other postings, but I still get the same
error.

Chrisoula Alexandraki wrote:
> 
> Hello all.
> 
> I see there are a couple of messages referring to my problem but no
> clear solution has been provided. So, I am afraid I shall have to bother
> you anyway.
> 
> My question is: If a have a namespace that does not correspond to a
> logicsheet, but is referenced by existing logicsheets, do I have to
> declare it inside every logicsheet served by cocoon?
> 
> In more detail: I have a logicsheet using the namespace prefix palio.
> 
> ============================
> So here is palio.xsl:
> ============================
> <?xml version="1.0"?>
> 
> <xsl:stylesheet version="1.0"   xmlns:xsp="http://apache.org/xsp"
>                                 xmlns:util="http://apache.org/xsp/util/2.0"
>                                 xmlns:palio="http://ics.forth.gr/palio"
>                                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                                 xmlns:ontology="http://ics.forth.gr/ontology">
> ...
> 
> <xsl:template match="palio:getInfo">
> 
>         <xsp:logic> String info = GISInvoker.getInstance().getInfo(
> "<xsl:value-of select="."/>" ); </xsp:logic>
> 
>         <util:include-expr><util:expr><xsp:expr> info
> </xsp:expr></util:expr></util:include-expr>
> 
> </xsl:template>
> 
> ...
> </xsl:stylesheet>
> 
> =======================
> 
> The string info returned by the java call contains:
> 
> <ontology:info><ontology:myname>Chrisoula</ontology:myname></ontology:info>
> 
> in other words an XML Sting with elements of xmlns ontology.
> When running cocoon I get a
> 
> =================================================
> org.xml.sax.SAXParseException: The namespace prefix "ontology" was not
> declared.
>         at
> org.apache.cocoon.components.parser.JaxpParser.error(JaxpParser.java:1
> ...
> ===================================================
> 
> and  <palio:getInfo> returns an empty String, even if I
> have declared xmlns:ontology="http://ics.forth.gr/ontology" both in the
> logicsheet (palio.xsl), as well as the XML template calling it
> (palio.xml).
> 
> I guess I should solve my problem by declaring the ontology namespace
> also in util.xsl and xsp.xsl. Well, is there a smarter solution?
> Something to declare in cocoon.xconf (such as a dummy logicsheet
> ontology.xsl), or whatever?
> 
> Many thanks,
> chrisoula


---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>