cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <vijayaraghavan.subraman...@wipro.com>
Subject Problem with XSLT + CForms in cocoon-2.1.8
Date Thu, 16 Feb 2006 10:09:17 GMT

Hi,

To create my CForms template dynamic, i use a XSLT to generate the
template file.

with cocoon-2.1.8, i'm getting following exception using below
construct:

<ft:widget id="reset">
  <fi:styling type="image" src="skin:/text-widgets/reset.gif" />
</ft:widget>

cause: java.lang.NullPointerException
org.apache.cocoon.ProcessingException: Failed to process pipeline
[TransformerException]
org.apache.cocoon.ProcessingException: Failed to process pipeline
at [TransformerException] -
file:/D:/ImageMerchant/deploy/mc.war/stylesheets/route-to-html.xsl:56:36
at <map:serialize type="xml"> -
file:/D:/ImageMerchant/deploy/mc.war/customer.xmap:2286:33
at <map:generate type="jx"> -
file:/D:/ImageMerchant/deploy/mc.war/customer.xmap:2285:64
at <map:serialize type="xhtml"> -
file:/D:/ImageMerchant/deploy/mc.war/customer.xmap:132:37
at <map:transform type="linkrewriter"> -
file:/D:/ImageMerchant/deploy/mc.war/customer.xmap:131:44
at <map:transform type="abs"> -
file:/D:/ImageMerchant/deploy/mc.war/customer.xmap:130:56

Whereas it's working fine in cocoon-2.1.7 & cocoon-2.1.5  + jboss-3.2.7

If i change the fi:styling to ft:styling (i vs t) everything is fine
"fi:" namespace declared correctly!!

and also i'm getting exception using  <ft:repeater-widget> construct

<ft:repeater-widget>
  <xsl:attribute name="id">
    <xsl:value-of select="concat('additionalUser-',id)" />
  </xsl:attribute>
  <ft:widget id="email"/>
</ft:repeater-widget>       


If i change the <ft:repeater-widget> to <ft:widget> seems to be working
fine ?
it's not working as CForms?

Any help would be appreciated.

Thanks, Vijay




MY CODE SNIPPET

flowscript entry
================

var routeToForm = new Form("cocoon:/route-comments-form-def");
routeToForm.showForm("route-comments-form");

sitemap.xmap entry
==================

<map:match pattern="routed-comments-template">
  <map:generate type="jx" src="templates/routedComments.jx"/>
  <map:serialize type="xml" />
</map:match> 

<map:match pattern="route-comments-form-def">
   <map:generate src="cocoon:/routed-comments-template" />
   <map:transform src="stylesheets/route-to-def.xsl">
     <map:parameter name="skin"
value="{prefs:{session-attr:prefWebapp}/skin:default}" />
   </map:transform> 
   <map:serialize type="xml" />
</map:match>


<map:match pattern="route-comments-form">
   <map:generate src="cocoon:/routed-comments-template" />
   <map:transform src="stylesheets/route-to-html.xsl">
     <map:parameter name="skin"
value="{prefs:{session-attr:prefWebapp}/skin:default}" />
   </map:transform>
   <map:call resource="show-form"/>
</map:match>

Definition file(route-to-def.xsl) entry
========================================

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
                xmlns:fd="
<http://apache.org/cocoon/forms/1.0#definition>
http://apache.org/cocoon/forms/1.0#definition"
                xmlns:i18n=" <http://apache.org/cocoon/i18n/2.1>
http://apache.org/cocoon/i18n/2.1"
                xmlns:xsl=" <http://www.w3.org/1999/XSL/Transform>
http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
<fd:form>
  <fd:widgets>
    <xsl:for-each select = "formfields/selectedimage">
   
      <fd:repeater initial-size = "1">
        <xsl:attribute name="id">
          <xsl:value-of select="concat('additionalUser-',id)" />
        </xsl:attribute>
        <fd:widgets>
          <fd:field id = "email">
            <fd:label><i18n:text>Forward to additional
users:</i18n:text></fd:label>
            <fd:datatype base = "string" />
            <fd:validation>
              <fd:email>
                <fd:failmessage>Not a Valid email
address</fd:failmessage>
              </fd:email>
            </fd:validation>
          </fd:field>
          <fd:row-action id = "add-entry" action-command = "add-after">
            <fd:label><i18n:text>Add</i18n:text></fd:label>
          </fd:row-action>
          <fd:row-action id = "delete-entry" action-command = "delete">
            <fd:label><i18n:text>Remove</i18n:text></fd:label>
            <fd:on-action>
              <javascript>
                var mailLen =
event.source.parent.lookupWidget("email").getParent().getParent().getSiz
e();
                if (mailLen == 0) {

event.source.parent.lookupWidget("email").getParent().getParent().addRow
();
                }
              </javascript>
            </fd:on-action>
          </fd:row-action>
        </fd:widgets>
      </fd:repeater>
     
    
    </xsl:for-each>

     
    <fd:submit id="submit1" action-command="submit">
      <fd:label><i18n:text>submit</i18n:text></fd:label>
    </fd:submit>
  
  </fd:widgets>
  </fd:form> 
</xsl:template>
</xsl:stylesheet> 
 
Template file(route-to-html.xsl) entry
=======================================


<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0"
    xmlns:ft=" <http://apache.org/cocoon/forms/1.0#template>
http://apache.org/cocoon/forms/1.0#template"
    xmlns:fi=" <http://apache.org/cocoon/forms/1.0#instance>
http://apache.org/cocoon/forms/1.0#instance"
    xmlns:i18n=" <http://apache.org/cocoon/i18n/2.1>
http://apache.org/cocoon/i18n/2.1"
    xmlns:xsl=" <http://www.w3.org/1999/XSL/Transform>
http://www.w3.org/1999/XSL/Transform"
    xmlns:xlink=" <http://www.w3.org/1999/xlink>
http://www.w3.org/1999/xlink">

<xsl:param name = "skin" />
<xsl:template match = "/">

<html>
  <head>
    <title>&#160;</title>
  </head>

  <body link="#3D70AF" vlink="#85ADDD"
onload="javascript:scrollAutomaticallyToSelectedOptionList();">

    <ft:form-template method="POST">
      <xsl:attribute name="action">
        <xsl:text>#{$continuation/id}.continue</xsl:text>
      </xsl:attribute>

      <div style="float: right; margin-top: 10px; margin-right: 10px;">
       <ft:widget id="submit1">
          <ft:styling type="image" src="skin:/text-widgets/submit.gif"
/>
        </ft:widget>
      </div>
      <ft:repeater-widget>
        <xsl:attribute name="id">
          <xsl:value-of select="concat('additionalUser-',id)" />
        </xsl:attribute>
        <ft:widget id="email"/>
        <ft:widget id="add-entry">
          <ft:styling type="image" src="skin:/actions/add.gif"/>
        </ft:widget>&#160;
        <ft:widget id="delete-entry">
          <ft:styling type="image" src="skin:/actions/remove.gif"/>
        </ft:widget>
      </ft:repeater-widget> 
        <br/>
      </ft:form-template>
  </body>
</html>
</xsl:template>
</xsl:stylesheet>







The information contained in this electronic message and any attachments to this message are
intended for the exclusive use of the addressee(s) and may contain proprietary, confidential
or privileged information. If you are not the intended recipient, you should not disseminate,
distribute or copy this e-mail. Please notify the sender immediately and destroy all copies
of this message and any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should check this email
and any attachments for the presence of viruses. The company accepts no liability for any
damage caused by any virus transmitted by this email.

www.wipro.com
Mime
View raw message