You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Chitharanjan Das <cd...@accordiasys.com> on 2002/03/28 06:22:49 UTC

Urgent: Problems in including XML fragment in XSP o/p

Hello,
	I am using cocoon 2.0,2 Tomcat 4.0.1 JDK 1.3.1

My match entry for my XSP reads like this ..
       <map:match pattern="xsp/compare">
		<map:act set="accordia">
			<map:generate type="serverpages"
src="docs/samples/xsp/compare.xsp"/>
			<map:transform type="cinclude"/>
			<map:transform type="i18n"/>
			<map:parameter name="component-xml"
value="C:\Projects\cocoon\Development\old-xml-cocoon2\build\cocoon\webap
p\docs\samples\jsp\items\components.xml"/>
			<map:parameter name="application-home-dir"
value="C:\Projects\cocoon\Development\old-xml-cocoon2\build\cocoon\webap
p\docs\samples\jsp\items"/>
			<map:parameter name="items-xsl"
value="docs/samples/jsp/xsl/items.xsl"/>
			<map:parameter name="graph-xsl"
value="docs/samples/jsp/xsl/graphrating.xsl"/>
		</map:act>
		<map:transform
src="docs/samples/jsp/xsl/accordia1.xsl"/>
		<map:serialize type="html"/>
		</map:match>
		

The actions performs the logic and sticks an XML in the request
attribute.
I need to extract the XML data from request and append it in the XSP o/p

//itemsXML is a java String object which contains an XML string (valid)

The XSP code snippet is
------------------------
	<area>
		<subarea>		
				<xsp:expr> 
				        itemsXML 
				  </xsp:expr> 
		</subarea>
	</area>	
-------------------------
If I do as above the contents of itemsXML is treated as String only and
not as XML and hence will not undergo transformation 


I then included the util logic sheet using the xml namespace declaration
as follows
<xsp:page language="java"
          xmlns:xsp="http://apache.org/xsp"
          xmlns:cinclude="http://apache.org/cocoon/include/1.0"
          xmlns:util="http://apache.org/xsp/util/2.0">

Modified the XSP code to include the following
------------------------
	<area>
		<subarea>
		   <util:include-expr>		
      		<util:expr> 
				<xsp:expr> 
				        itemsXML 
				  </xsp:expr> 
			 </util:expr> 
		   </util:include-expr>	  
		</subarea>
	</area>	
-------------------------
	I got a syntax error in XSP compilation
Note:// I got this from an earlier posting in the users mail list


I then  removed the <util:include-expr> tag , the XSP compiles but still
treats ItemXML as a String

Please advice what to do,
I hope I am being clear


To Summarize,
	How do I stick an XML fragment (stored in a variable) into the
XSP o/p without it getting treated as a String..


	


---------------------------------------------------------------------
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: Urgent: Problems in including XML fragment in XSP o/p

Posted by John Austin <jo...@integerservices.no-ip.com>.
> The XSP code snippet is
> ------------------------
> 	<area>
> 		<subarea>
> 				<xsp:expr>
> 				        itemsXML
> 				  </xsp:expr>
> 		</subarea>
> 	</area>
> -------------------------
> If I do as above the contents of itemsXML is treated as String only
> and not as XML and hence will not undergo transformation

I was trying to solve a similar problem last week. I have an XML doc 
that I stuff into the session context at one point and I needed to pull 
it out and feed it to a simple XSLT transformation pipeline.

The documentation and the mail archive seemed to suggest that I was 
attempting some sort of pagan rite that had been banned to preserve 
theological purity. I had to fall back on an ancient technology: 
JavaServer Pages. The first version of this code was written as a 
servlet and I needed to get the servlet functionality to work quickly.

The example JSP's in C2 work quite well and I wrote a JSP that did 
exactly what I needed. [Nice to know that a JSP becomes a servlet.]

---------------------------------------------------------------------
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: Urgent: Problems in including XML fragment in XSP o/p

Posted by Chitharanjan Das <cd...@accordiasys.com>.
Thanks  a lot Vadim,,,,,

It's working now. The issue was the whitespaces between <util:expr> and
<xsp:ezpr> elements. There should be no whitespaces. The java code
indicated this. I then removed the whitespace and it started working.
I guess, this kind of subtle behaviours should be documented. They could
have already been. But the FAQ's I referred did not have it..

Once again,
Thanks a lot ,

Regds,
Chiths

-----Original Message-----
From: Vadim Gritsenko [mailto:vadim.gritsenko@verizon.net] 
Sent: Thursday, March 28, 2002 5:42 AM
To: cocoon-users@xml.apache.org
Subject: RE: Urgent: Problems in including XML fragment in XSP o/p

Chitharanjan:


1. Have you tried 

<util:include-expr>		
  <util:expr><xsp:expr>itemsXML</xsp:expr></util:expr> 
</util:include-expr>

?

2. Have you seen generated java class?

Vadim

> From: Chitharanjan Das [mailto:cdas@accordiasys.com]
> 
> Hello,
> 	I am using cocoon 2.0,2 Tomcat 4.0.1 JDK 1.3.1
> 
> My match entry for my XSP reads like this ..
>        <map:match pattern="xsp/compare">
> 		<map:act set="accordia">
> 			<map:generate type="serverpages"
> src="docs/samples/xsp/compare.xsp"/>
> 			<map:transform type="cinclude"/>
> 			<map:transform type="i18n"/>
> 			<map:parameter name="component-xml"
>
value="C:\Projects\cocoon\Development\old-xml-cocoon2\build\cocoon\webap
> p\docs\samples\jsp\items\components.xml"/>
> 			<map:parameter name="application-home-dir"
>
value="C:\Projects\cocoon\Development\old-xml-cocoon2\build\cocoon\webap
> p\docs\samples\jsp\items"/>
> 			<map:parameter name="items-xsl"
> value="docs/samples/jsp/xsl/items.xsl"/>
> 			<map:parameter name="graph-xsl"
> value="docs/samples/jsp/xsl/graphrating.xsl"/>
> 		</map:act>
> 		<map:transform
> src="docs/samples/jsp/xsl/accordia1.xsl"/>
> 		<map:serialize type="html"/>
> 		</map:match>
> 
> 
> The actions performs the logic and sticks an XML in the request
> attribute.
> I need to extract the XML data from request and append it in the XSP
o/p
> 
> //itemsXML is a java String object which contains an XML string
(valid)
> 
> The XSP code snippet is
> ------------------------
> 	<area>
> 		<subarea>
> 				<xsp:expr>
> 				        itemsXML
> 				  </xsp:expr>
> 		</subarea>
> 	</area>
> -------------------------
> If I do as above the contents of itemsXML is treated as String only
and
> not as XML and hence will not undergo transformation
> 
> 
> I then included the util logic sheet using the xml namespace
declaration
> as follows
> <xsp:page language="java"
>           xmlns:xsp="http://apache.org/xsp"
>           xmlns:cinclude="http://apache.org/cocoon/include/1.0"
>           xmlns:util="http://apache.org/xsp/util/2.0">
> 
> Modified the XSP code to include the following
> ------------------------
> 	<area>
> 		<subarea>
> 		   <util:include-expr>
>       		<util:expr>
> 				<xsp:expr>
> 				        itemsXML
> 				  </xsp:expr>
> 			 </util:expr>
> 		   </util:include-expr>
> 		</subarea>
> 	</area>
> -------------------------
> 	I got a syntax error in XSP compilation
> Note:// I got this from an earlier posting in the users mail list
> 
> 
> I then  removed the <util:include-expr> tag , the XSP compiles but
still
> treats ItemXML as a String
> 
> Please advice what to do,
> I hope I am being clear
> 
> 
> To Summarize,
> 	How do I stick an XML fragment (stored in a variable) into the
> XSP o/p without it getting treated as a String..


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




---------------------------------------------------------------------
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: Urgent: Problems in including XML fragment in XSP o/p

Posted by Vadim Gritsenko <va...@verizon.net>.
Chitharanjan:


1. Have you tried 

<util:include-expr>		
  <util:expr><xsp:expr>itemsXML</xsp:expr></util:expr> 
</util:include-expr>

?

2. Have you seen generated java class?

Vadim

> From: Chitharanjan Das [mailto:cdas@accordiasys.com]
> 
> Hello,
> 	I am using cocoon 2.0,2 Tomcat 4.0.1 JDK 1.3.1
> 
> My match entry for my XSP reads like this ..
>        <map:match pattern="xsp/compare">
> 		<map:act set="accordia">
> 			<map:generate type="serverpages"
> src="docs/samples/xsp/compare.xsp"/>
> 			<map:transform type="cinclude"/>
> 			<map:transform type="i18n"/>
> 			<map:parameter name="component-xml"
>
value="C:\Projects\cocoon\Development\old-xml-cocoon2\build\cocoon\webap
> p\docs\samples\jsp\items\components.xml"/>
> 			<map:parameter name="application-home-dir"
>
value="C:\Projects\cocoon\Development\old-xml-cocoon2\build\cocoon\webap
> p\docs\samples\jsp\items"/>
> 			<map:parameter name="items-xsl"
> value="docs/samples/jsp/xsl/items.xsl"/>
> 			<map:parameter name="graph-xsl"
> value="docs/samples/jsp/xsl/graphrating.xsl"/>
> 		</map:act>
> 		<map:transform
> src="docs/samples/jsp/xsl/accordia1.xsl"/>
> 		<map:serialize type="html"/>
> 		</map:match>
> 
> 
> The actions performs the logic and sticks an XML in the request
> attribute.
> I need to extract the XML data from request and append it in the XSP
o/p
> 
> //itemsXML is a java String object which contains an XML string
(valid)
> 
> The XSP code snippet is
> ------------------------
> 	<area>
> 		<subarea>
> 				<xsp:expr>
> 				        itemsXML
> 				  </xsp:expr>
> 		</subarea>
> 	</area>
> -------------------------
> If I do as above the contents of itemsXML is treated as String only
and
> not as XML and hence will not undergo transformation
> 
> 
> I then included the util logic sheet using the xml namespace
declaration
> as follows
> <xsp:page language="java"
>           xmlns:xsp="http://apache.org/xsp"
>           xmlns:cinclude="http://apache.org/cocoon/include/1.0"
>           xmlns:util="http://apache.org/xsp/util/2.0">
> 
> Modified the XSP code to include the following
> ------------------------
> 	<area>
> 		<subarea>
> 		   <util:include-expr>
>       		<util:expr>
> 				<xsp:expr>
> 				        itemsXML
> 				  </xsp:expr>
> 			 </util:expr>
> 		   </util:include-expr>
> 		</subarea>
> 	</area>
> -------------------------
> 	I got a syntax error in XSP compilation
> Note:// I got this from an earlier posting in the users mail list
> 
> 
> I then  removed the <util:include-expr> tag , the XSP compiles but
still
> treats ItemXML as a String
> 
> Please advice what to do,
> I hope I am being clear
> 
> 
> To Summarize,
> 	How do I stick an XML fragment (stored in a variable) into the
> XSP o/p without it getting treated as a String..


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