Jozsa Kristof writes:

 > Under linux I use xsltproc, and it shortens the
 > xsl-tinkering/testing/aint-work cycle very much.

Great tool, I didn't know that. An alternative (and dirty)
approach is to intercept the SAX stream in the pipeline and write
it to a file.

Place this into the sitemap (somewhere where a transformer can be
placed, i.e. after a generator or another transformer):

<!-- ==== write files for debugging ==== -->
  <map:transform src="stylesheets/saveToFile.xsl"> 
    <map:parameter name="filename" value="/home/tinu/debug/mySAXstream.xml"/>
  </map:transform>


if you use Xalan (in the Cocoon distribution), the stylesheet
looks like:

<!-- <?xml version="1.0" encoding="iso-8859-1"?> -->

<!-- ********************************************************************
     $Id: saveToFile.xsl,v 1.4 2002/01/17 14:08:30 tinuwyonacms Exp $
     ********************************************************************
     

     ********************************************************************

     author:       [EMAIL PROTECTED]
     creationdate: 19.12.2001
     license:      apache-like

     Copyright 2001, wyona AG, Zurich, Switzerland

     ******************************************************************** -->
 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    version="1.0"
    xmlns:redirect="org.apache.xalan.lib.Redirect"
    extension-element-prefixes="redirect">

<xsl:output method="xml" version="1.0" indent="yes" encoding="iso-8859-1"/>

<xsl:param name="filename"/>

<xsl:template match="/">
  <redirect:write file="{$filename}">
    <xsl:copy-of select="."/>
    <xsl:fallback>
      ===== ERROR: Cocoon is not using Xalan, the file could not be saved =====
    </xsl:fallback>
  </redirect:write>
  <xsl:copy-of select="."/>
</xsl:template>

</xsl:stylesheet>

If you use something else than Xalan, the redirect method is
called differently (see e.g. in Michael Kay's 900 page XSLT
book). And don't forget to cancel these lines from the sitemap,
as it will certainly be slow and non-portable.

Have fun!

Tinu



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