cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robin Green" <>
Subject Re: XSP adding XML java.
Date Wed, 03 May 2000 19:39:16 GMT
Kees Jongenburger <>  wrote:
>i am currently writing a poll class witch should be used as part of an 
>to be incorporated with different pages. Now the poll class should return 
>of an XML document something like
>	<question>
>	    <title>Should Cocoon have default polls?</title>
>	    <answers>
>		    <answer name="Yes Yes Yes!!!" value="yes"/>
>		    <answer name="No No No!!!" value="yes"/>
>	    </answers>
>	</question>
>my xsl(from the lib) looks like this:
><xsl:template match="netlinq:poll">
>         <xsl:copy>
>              <xsp:expr>forum.getForum()</xsp:expr>
>         </xsl:copy>
>Now in java if i return a String the < and > tags are transformed so that
>the exact text is displayed . If i return an XObject results are better
>(only the #text is returned but the tags are omited)
>what should the aproch be?
>i realy whant to be able to use "Pure" java to create document fragments 
>wil be processed by the xslt

No probs. I've been doing that myself for a web discussion board package. 
It's easy. Just build a DOM Element and don't use <xsp:expr> to insert it, 
but instead use this code, or something like it:

<xsl:template match="netlinq:poll">
       xspCurrentNode.appendChild (forum.getForum());

I have made a little tag to encapsulate this (when using XSP), called 

  <xsl:template match="add-node">

so you can then just say (in an XSP page, not in a stylesheet)

  <add-node>object.toXML() // NOTE: no semicolon

but that's just for convenience, you don't need to make an abstract tag for 


270+ Open Source Java links!

Get Your Private, Free E-mail from MSN Hotmail at

View raw message