On Fri, Dec 14, 2001 at 05:05:44PM +0900, Adam A R wrote:
> Hello all,
> 
> I am using Cocoon 1.8 with iAWS server.
> 
> I have the following flow in my application.
> 
> XML -> XSP -> XSLT
> 
> XML file processed by XSP(actually an XSL) to add dynamic content. The
> output of which is transformed by a Stylsheet and the result returned
> to the user.
> 
> Now, I want to look at the output generated by the XSP.

Just remove the <?cocoon-process type="xslt"?> PI, and change the MIME
type specified in cocoon-format to text/xml. So at the top of your XML
you'd have:

<?cocoon-process type="xsp"?>
<?cocoon-format type="text/xml"?>

You could also leave the XSLT processor in place, but use either:

 -  an "identity transform" stylesheet that doesn't alter the incoming
    XML,
 -  a stylesheet that pretty-prints the XML for viewing in the browser
        (like IE does).

I've attached a simple identity transform xsl. You can find a good "view
XML as HTML" stylesheet in xml-xalan/java/samples/servlet/default.xsl

When developing, I like to be able to switch to the debug stylesheet
without editing XSPs. You can dynamically select the applied stylesheet
with an XSP like this:

<?cocoon-process type="xsp"?>
<?cocoon-process type="xslt"?>
<xsp:page language="java"
    xmlns:request="http://www.apache.org/1999/XSP/Request";
    xmlns:xsp="http://www.apache.org/1999/XSP/Core";
    xmlns:util="http://www.apache.org/1999/XSP/Util";>
    <page>
    <xsp:pi target="xml-stylesheet">href="
        <xsp:expr>
              <request:get-parameter name="ss" default="normal.xsl" />
        </xsp:expr>
        " type="text/xsl"</xsp:pi>

    </page>
</xsp:page>

Then by default, "normal.xsl" will be applied, but if you append
"?ss=identity.xsl", you'll get identity.xsl applied instead.


--Jeff

> cheers
> Adam
<?xml version="1.0"?>

<!-- An identity transformation
 [EMAIL PROTECTED]
 -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="xml" media-type="text/xml" indent="yes"/>

<xsl:template match="/">
  <xsl:copy-of select="node()"/>
</xsl:template>

</xsl:stylesheet>

---------------------------------------------------------------------
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: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to