cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Switzer <sswit...@myra.com>
Subject Re: help with "Included Logicsheet" and pipeline
Date Thu, 21 Aug 2003 19:29:56 GMT
Perhaps David Parry can be of some service?

Thanks, Steve Switzer.

Steve Switzer wrote:

> Jay Freeman (saurik) wrote:
>
>>Steve:
>>
>>The whole <?cocoon-process?> thing was functionality that existed before the
>>sitemap came into being. With Cocoon 2 you can't generate XSP code and then
>>execute it.
>>  
>>
> I thought the <?cocoon-process?> tag looked a little fishy.  I'll take 
> it out, and the resulting xsl will look like:
>
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:xsp="http://www.apache.org/1999/XSP/Core">
> <xsl:template match="test">
> <xsp:logic>
> System.out.println("<xsl:apply-templates/>");
> </xsp:logic>
> </xsl:template>
> </xsl:stylesheet>
>
> When I call the URL, the result back at the client is now:
>
><xsp:logic xmlns:xsp="http://www.apache.org/1999/XSP/Core">
>System.out.println("hello world");
></xsp:logic>
>
>I'm not sure that I understand your point that I can't "generate XSP code and then execute
it".
>Isn't that what XSP code is for?  Oh... maybe I do get it.  You can execute XSP code that
you have written,
>but you can't execute XSP code that is generated.
>
>Then what's the point of the examples I found at the 2 URL's listed below?
>http://www.suranyami.com/XSPtutorial/ says:
>
>
>>
>>         Included logicsheet
>>
>> This is a much more preferable way to be working, whereby parts of 
>> the original XML document that are matched by the stylesheet are 
>> replaced with sections of logic code.
>>
>> In this scenario, an XSP page is generated from the original XML 
>> page, rather than the original XML page BEING an XSP page.
>>
>> This is an example of a "logicsheet". The original XML file's 
>> elements are replaced with pieces of logic (or plain ole XML, as 
>> needed). The transformation is done by an XSL stylesheet, the results 
>> of which are pieces of XSP logic or expressions.
>>
>> In the diagram we see that the |<item/>| element will be substituted 
>> with the contents of the |<template match="item></template>| element.

>> In this case, it's an |<xsp:expr></xsp:expr>| element which will 
>> presumably contain some kind of Java code, which, when executed will 
>> insert a text node into the XML result tree.
>>
>> More importantly than the specific contents of the page, once again 
>> it is important that the root element of the resulting XSP page is an 
>> |<xsp:page>| element.
>>
>> By this stage, the result of this transformation (produced by the 
>> logicsheet) is a canonical XSP page. This will then be "executed" and 
>> the result will be an XML page, with all the variable bits replaced 
>> with actual values. Once again, the XSL stylesheet transforms the 
>> final outcome into a HTML page.
>>
>The diagram he refers to is _almost_ identical to the diagram given at the Included Logicsheet
section of
>http://cocoon.apache.org/2.0/userdocs/concepts/#c2-abstractions
>
>Look at: http://cocoon.apache.org/2.0/userdocs/concepts/images/xsp-way2.gif
>and: http://www.suranyami.com/XSPtutorial/XSP2.gif
>
>I personally think the problem lies in my pipeline, but I don't know how to fix it.
>  
>
>>----- Original Message -----
>>From: "Steve Switzer" <sswitzer@myra.com>
>>Sent: Wednesday, August 20, 2003 4:49 PM
>>  
>>
>>>I'm trying to execute Java based on the contents of some xml-ized data.
>>>I found the "Included Logicsheet" notes at:
>>>http://www.suranyami.com/XSPtutorial/ and
>>>http://cocoon.apache.org/2.0/userdocs/concepts/#c2-abstractions
>>>
>>>My understanding is the data-XML gets transformed by the xsl into an xsp
>>>that will contain java logic.
>>>I'm not so interested in the XML produced by the xsp, but perhaps I
>>>could use serialize it as html.
>>>
>>>Here's my problem -- the 2 examples I've seen look so simple, but I can
>>>only get serialized XSP, i.e., with no executed java.
>>>
>>>Let me give you the file contents:
>>>
>>>(http request:  http://ourtomcatserver.foo.com/cocoon/test )
>>>------------
>>>sitemap.xmap:
>>>...
>>><map:match type="regexp" pattern="test">
>>><map:generate src="/home/sswitzer/public_xml/test.xml"/>
>>><map:transform src="/home/sswitzer/public_xml/test.xsl"/>
>>><map:serialize/>
>>></map:match>
>>>...
>>>------------
>>>test.xml:
>>><test>hello world</test>
>>>------------
>>>test.xsl:
>>><?xml version="1.0"?>
>>><xsl:stylesheet version="1.0"
>>>xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>>>xmlns:xsp="http://www.apache.org/1999/XSP/Core">
>>><xsl:template match="test">
>>><xsl:processing-instruction
>>>name="cocoon-process">type="xsp"</xsl:processing-instruction>
>>><xsp:logic>
>>>System.out.println("<xsl:apply-templates/>");
>>></xsp:logic>
>>></xsl:template>
>>></xsl:stylesheet>
>>>
>>>My client gets back:
>>>
>>><?cocoon-process type="xsp">
>>>
>>><xsp:logic xmlns:xsp="http://www.apache.org/1999/XSP/Core">
>>>System.out.println("hello world");
>>></xsp:logic>
>>>
>>>Which is really cool, considering that it's well set up xsp -- but it
>>>    
>>>
>>doesn't execute anything!
>>  
>>
>>>Am I on the right track?  My end result is that the xml-ized data gets put
>>>    
>>>
>>into java objects
>>  
>>
>>>which I'll then pass on to a servlet.
>>>
>>>    
>>>
>>  
>>

Mime
View raw message