You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Martin Holmes <mh...@uvic.ca> on 2005/04/28 00:21:00 UTC

Missing xml declaration and doctype when using XQuery

Hi there,

I have the following two matches in my pipeline:


<!-- Standard XHTML transform -->

   <map:match pattern="proof/*.htm">
     <map:generate src="abstracts_for_proofing/{1}.xml"/>
     <map:transform type="xinclude"/>
     <map:transform type="xslt" src="xsl/tei_ach_single_doc_to_xhtml.xsl"/>
     <map:serialize type="xhtml"></map:serialize>
   </map:match>

<!-- XQuery retrieval to XHTML output -->
   <map:match pattern="xq/xhtml.xq">
     <map:generate src="xq/abstract.xq" type="xquery">
         <map:parameter name="expand-xincludes" value="true"/>
     </map:generate>
     <map:transform type="xslt" src="xsl/tei_ach_single_doc_to_xhtml.xsl"/>
     <map:transform type="encodeURL"/>
     <map:serialize type="xhtml"></map:serialize>
   </map:match>

In the case of the first, I get this at the top of my XHTML output document:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
   PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

In the case of the second, I get nothing before the HTML tag:

<html xmlns="http://www.w3.org/1999/xhtml">

Can anyone suggest why this might be the case? In the first case, the 
XML input to the transformation is taken from a file, and in the second, 
it's taken from the an eXist database via XQuery, but there's no other 
difference in the pipelines -- same transformation, same serialization. 
The second has an "encodeURL" transform, but even if I remove that, it 
makes no difference. I'd really like to be producing good XHTML from 
this application. Any ideas?

All help appreciated.

Cheers,
Martin


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


Re: Cocoon & Web Services

Posted by Bertrand Delacretaz <bd...@apache.org>.
Le 28 avr. 05, à 02:14, Nima Jafari a écrit :
> ...i would like to use Cocoon to consume a Web Service...

Did you look at http://wiki.apache.org/cocoon/FlowAndWebServices ?

This is experimental but it might help.

-Bertrand


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


Re: Cocoon & Web Services

Posted by Reinhard Poetz <re...@apache.org>.
Nima Jafari wrote:
> Hi,
> 
> i would like to use Cocoon to consume a Web Service...
> The Sample Hello World Web Service didn't give me any clues in how to 
> solve my case which is the following:
> 
> The Web Service expects an String as parameter and Returns a 
> corresponding Response...
> 
> now my question is: how can call the service with cocoon? i saw that XSP 
> thing in the docu which uses basically java to handle the logic...i 
> allready implemented a Web Service Client in JSP...can i use the same 
> code for the XSP?
> 
> Anyone got a clue or maybe an example for calling a Web Service (maybe 
> there is also something to work with the WSDL file of the Service...like 
> there is the WSDL2Java in Apache Axis???)

I'd use Java code which was generated by Axis within the controller (Flowscript, 
Javaflow, Apples or an action)

Putting a webservice call into the presentation layer violates the sepration of 
model, view and controller.

-- 
Reinhard Pötz           Independent Consultant, Trainer & (IT)-Coach 

{Software Engineering, Open Source, Web Applications, Apache Cocoon}

                                        web(log): http://www.poetz.cc
--------------------------------------------------------------------


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


Cocoon & Web Services

Posted by Nima Jafari <n....@mnet-mail.de>.
Hi,

i would like to use Cocoon to consume a Web Service...
The Sample Hello World Web Service didn't give me any clues in how to 
solve my case which is the following:

The Web Service expects an String as parameter and Returns a 
corresponding Response...

now my question is: how can call the service with cocoon? i saw that XSP 
thing in the docu which uses basically java to handle the logic...i 
allready implemented a Web Service Client in JSP...can i use the same 
code for the XSP?

Anyone got a clue or maybe an example for calling a Web Service (maybe 
there is also something to work with the WSDL file of the Service...like 
there is the WSDL2Java in Apache Axis???)

regards
jaf


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


Re: Missing xml declaration and doctype when using XQuery

Posted by Martin Holmes <mh...@uvic.ca>.
Answering my own question, in case anyone else has the same problem:

My XQuery was returning this:

<TEI.2>
	<!-- Query Results -->
	{f:GetDoc()}
</TEI.2>

If I make it return this:

<document>
<TEI.2>
	<!-- Query Results -->
	{f:GetDoc()}
</TEI.2>
</document>

Then it works. Apparently the container tag is required before the 
doctype headers will be generated.

Cheers,
Martin


Martin Holmes wrote:
> Hi there,
> 
> I have the following two matches in my pipeline:
> 
> 
> <!-- Standard XHTML transform -->
> 
>   <map:match pattern="proof/*.htm">
>     <map:generate src="abstracts_for_proofing/{1}.xml"/>
>     <map:transform type="xinclude"/>
>     <map:transform type="xslt" src="xsl/tei_ach_single_doc_to_xhtml.xsl"/>
>     <map:serialize type="xhtml"></map:serialize>
>   </map:match>
> 
> <!-- XQuery retrieval to XHTML output -->
>   <map:match pattern="xq/xhtml.xq">
>     <map:generate src="xq/abstract.xq" type="xquery">
>         <map:parameter name="expand-xincludes" value="true"/>
>     </map:generate>
>     <map:transform type="xslt" src="xsl/tei_ach_single_doc_to_xhtml.xsl"/>
>     <map:transform type="encodeURL"/>
>     <map:serialize type="xhtml"></map:serialize>
>   </map:match>
> 
> In the case of the first, I get this at the top of my XHTML output 
> document:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE html
>   PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> 
> In the case of the second, I get nothing before the HTML tag:
> 
> <html xmlns="http://www.w3.org/1999/xhtml">
> 
> Can anyone suggest why this might be the case? In the first case, the 
> XML input to the transformation is taken from a file, and in the second, 
> it's taken from the an eXist database via XQuery, but there's no other 
> difference in the pipelines -- same transformation, same serialization. 
> The second has an "encodeURL" transform, but even if I remove that, it 
> makes no difference. I'd really like to be producing good XHTML from 
> this application. Any ideas?
> 
> All help appreciated.
> 
> Cheers,
> Martin


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