A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.

Jump to

Quick reference

Showing posts with label cocoon. Show all posts
Showing posts with label cocoon. Show all posts

Cocoon documentation

Current:
  • Wiki: http://wiki.apache.org/cocoon/FrontPage (question about docs. Answer: Understand How ASF works)
  • Official v2 site: http://cocoon.apache.org/
  • Jira bug tracking: https://issues.apache.org/jira/browse/COCOON (issue about docs - there are several more issues regarding out-of-date contribution procedures)
  • Cocoon 3 alpha: http://people.apache.org/~reinhard/c3-ref/html/
  • List of mailing lists: http://svn.apache.org/repos/asf/cocoon/site/site/mail-lists.html (also a browsable SVN repository of the documentation website - will updating this fix the live site?)
  • Main site mailing lists: http://cocoon.apache.org/2.1/1175.html
  • Searchable mailing list archives: http://markmail.org/search/?q=list%3Aorg.apache.cocoon.users
    • and http://markmail.org/search/?q=list%3Aorg.apache.cocoon.dev

Dead or out-of-date:
  • org.apache.cocoon.docs - is this dead?
  • This link to Cocoon Bugzilla is dead (it should be Jira now anyway): http://cocoon.apache.org/2.0/howto/howto-bugzilla.html
  • Many of the links on this menu are dead: http://cocoon.apache.org/2.0/
  • The "View, Edit or comment" link at the bottom of this page is dead: http://cocoon.apache.org/

Criticism:

    oXygen Eclipse plugin

    oXygen XML/XSLT: http://www.oxygenxml.com/download_oxygenxml_editor.html#Eclipse
    • it's not all that, but step-through-debugging does work
    • have to manually set the file association defaults to Oxygen types
    • unreadable default colour scheme for Oxygen filetypes. It is difficult to import syntax-highlighting preferences in Eclipse. You're better off setting them yourself.
    • to use step-through debugging, you need to:
      • 'Configure Transformation Scenario' (under XML/XSL menu - it appears when you open an XML or XSL file)
      • open the 'Debug Scenario' perspective in the XML/XSL menu
    • setting the input parameters for debugging is fiddly
    • the XML file being used as input must be "part of the project"

    Cocoon XSLT errors

    java.lang.NullPointerException

    This could mean you've used the wrong attribute name in a tag, e.g.
    <xsl:attribute type="type">
    instead of
    <xsl:attribute name="type">

    There seems to be no syntax checking to warn in cases like this.

    Using Java classes from XSLT under Coocon / JBoss

    Possible MD5 methods:
    <xsl:value-of select="md5:encode('$term')" xmlns:md5="java:org.jboss.security.Base64Encoder" />
    <xsl:value-of select="md5:encodeString($term,'ISO-8859-1')" xmlns:md5="java:org.hsqldb.lib.MD5" />

    Search through built-in classes in JBoss:
    find /path/to/jboss-4.2.2.GA/server/default/ -name "*.jar" -exec jar tf {} \; | grep MD5 -H

    JSP/XSP generator in Cocoon

    Warning: Untested.

    In the sitemap.xmap:

    <map:match pattern="^(\d+)$" type="regexp">
    <map:generate type="serverpages" src="sfapi.xsp">
    <map:parameter name="feedid" value="{1}"/>
    </map:generate>

    The source of sfapi.xsp

    <?xml version="1.0" encoding="UTF-8"?>
    <xsp:page language="java" xmlns:xsp="http://apache.org/xsp" xmlns:soap="http://apache.org/xsp/soap/3.0">
    <results>
    <xsp:logic>
    int feedid=0;
    try {
    feedid = Integer.parseInt(parameters.getParameter("feedid"));
    } catch (Exception e) {
    feedid = -999;
    }
    </xsp:logic>

    <soapcall
    xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/1999/XMLSchema"
    url="/FeedManager"
    >

    <m:getFeedData xmlns:m="http://else.something.co.uk/ns/feeds">
    <int_1 xsi:type="xsd:int"><xsp:expr>feedid</xsp:expr></int_1>
    </m:getFeedData>

    </soapcall>

    </results>
    </xsp:page>

    Pass a parameter to XSL in Cocoon

    In the sitemap:

    <map:transform src="xslt/page.xsl">
    <map:parameter name="param1" value="{1}"/>
    </map:transform>

    In the XSL:

    <xsl:param name="param1"/>

    ...

    <xsl:template match="whatever">
    <xsl:attribute name="something">
    <xsl:value-of select="$param1"/>
    </xsl:attribute>
    </xsl:template>