cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew <andrewm...@gmail.com>
Subject Re: Cocoon-Ajax issue
Date Tue, 18 Jul 2006 12:39:39 GMT
Hi,
nothing is being written into the head tags of my xsl files:

myXSL.xsl:

<?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:cinclude="http://apache.org/cocoon/include/1.0">
        <xsl:template match="/">
          <html>
                <head>

sitemap pipe:
            <map:match pattern="**viewform-*">
                <map:generate type="jx" src="jx/{2}.jx"/>
                <map:transform type="forms"/>
                <map:transform type="browser-update"/>
                <map:transform type="i18n">
                  <map:parameter name="locale" value="en-US"/>
                </map:transform>
                <map:transform src="template-style/forms-samples-styling.xsl
"/>
                <map:transform type="cinclude"/>
                <map:transform type="xslt-saxon" src="style/{2}.xsl"/>
                <map:transform type="cinclude"/>
                <map:transform type="i18n">
                  <map:parameter name="locale" value="en-US"/>
                </map:transform>
                <map:select type="ajax-request">
                  <map:when test="true">
                    <map:serialize type="xml"/>
                  </map:when>
                  <map:otherwise>
                    <map:serialize type="xhtml"/>
                  </map:otherwise>
                </map:select>
            </map:match>

forms-sample-styling.xsl:

  <xsl:include href="resource://org/apache/cocoon/forms/resources/forms-
page-styling.xsl"/>
  <xsl:include href="resource://org/apache/cocoon/forms/resources/forms-
advanced-field-styling.xsl"/>

  <xsl:param name="resources-uri">resources</xsl:param>

  <xsl:template match="head">
    <head>
      <xsl:apply-templates select="." mode="forms-page"/>
      <xsl:apply-templates select="." mode="forms-field"/>
      <xsl:apply-templates/>
    </head>
  </xsl:template>

forms-advanced-field-styling.xsl:

  <xsl:import href="resource://org/apache/cocoon/forms/resources/forms-
field-styling.xsl"/>
  <xsl:include href="resource://org/apache/cocoon/forms/resources/forms-
calendar-styling.xsl"/>
  <xsl:include href="resource://org/apache/cocoon/forms/resources/forms-
htmlarea-styling.xsl"/>

  <xsl:template match="head" mode="forms-field">
    <xsl:apply-imports/>
    <script src="{$resources-uri}/forms/mattkruse-lib/AnchorPosition.js"
type="text/javascript"/>
    <script src="{$resources-uri}/forms/mattkruse-lib/PopupWindow.js"
type="text/javascript"/>
    <script src="{$resources-uri}/forms/mattkruse-lib/OptionTransfer.js"
type="text/javascript"/>
    <script src="{$resources-uri}/forms/mattkruse-lib/selectbox.js"
type="text/javascript"/>
    <xsl:apply-templates select="." mode="forms-calendar"/>
    <xsl:apply-templates select="." mode="forms-htmlarea"/>
  </xsl:template>

What am I overlooking here?

regards

Andrew
On 18/07/06, Andrew <andrewmadu@gmail.com> wrote:
>
> Hi Jason,
> seems you may have a winner here. I'm having a problem with where the
> resource link is pointing to as none of the files are being picked up:
>
>   <xsl:include href="resource://org/apache/cocoon/forms/resources/forms-
> page-styling.xsl"/>
>   <xsl:include href="resource://org/apache/cocoon/forms/resources/forms-
> advanced-field-styling.xsl"/>
>
> My project sits in the root.war folder of my jboss application server, and
> my folder stucture is as follows:
>
> root.war - myproject/
>             - cocoon/
>             - resources/
>             - samples/
>             - slide/
>             - stylesheets/
>             - test-suite/
>             - WEB-INF/
>             - not-found.xml | sitemap.xmap | welcome.xml | welcome.xslt
>
> Now all the documents required are within the cocoon folder, for example
> forms-advanced-field-styling.xsl is located at:
>
> root /cocoon/blocks/orms/dest/org/apache/cocoon/forms/resources/
>
> So my question is, and in relation to the cocoon folder, where exactly are
> the following references being resolved to?:
>
>   <xsl:include href="resource://org/apache/cocoon/forms/resources/forms-
> page-styling.xsl "/>
>   <xsl:include href="resource://org/apache/cocoon/forms/resources/forms-
> advanced-field-styling.xsl"/>
> <xsl:param name="resources-uri">resources</xsl:param>
>
> regards
>
> Andrew
>
> On 18/07/06, Jason Johnston <cocoon@lojjic.net> wrote:
> >
> > Andrew wrote:
> > > Hi Simone,
> > > Basically my problem is that after setting ajax="true" in my
> > > ft:form-template and defining my jx-macros line:
> > >
> > > <jx:import
> > > uri="resource://org/apache/cocoon/forms/generation/jx- macros.xml"/>
> > >     <tableR>
> > >         <ft:form-template action="creditCard.kont" id="Form1"
> > > method="POST" ajax="true">
> > >
> > > and in my sitemap doing:
> > >
> > > 1. <map:transformer name="browser-update"
> > > src="org.apache.cocoon.ajax.BrowserUpdateTransformer"/> in
> > > map:transformers and:
> > >
> > > 2. <map:selector name="ajax-request" src="
> > > org.apache.cocoon.ajax.AjaxRequestSelector"/> in my map:selectors
> > >
> > > and my pipeline being defined as so:
> > >
> > >             <map:match pattern="**viewform-*">
> > >                 <map:generate type="jx" src="jx/{2}_.jx"/>
> > >                 <map:transform type="browser-update"/>
> > >                 <map:transform type="forms"/>
> > >                 <map:transform type="i18n">
> > >                   <map:parameter name="locale" value="en-US"/>
> > >                 </map:transform>
> > >                 <map:transform
> > > src="resources/forms-advanced-field-styling2.xsl "/>
> >
> > What is the XSLT file from this above line?  Is it a copy of
> > forms-advanced-field-styling.xsl from the Cocoon distribution?  Normally
> > you have a separate XSLT file that includes the Cocoon-provided XSLTs,
> > (see forms-samples-styling.xsl in the CForms samples), rather than using
> > them directly.
> >
> > Using them directly will *not* insert the correct <script> references in
> > the head of the HTML document, so anything that requires client-side
> > JavaScript (AJAX!) will not function.
> >
> > Check the source of your HTML output and verify that it has all the
> > <script> tags that are in the CForms samples; if not then this is
> > probably your issue.
> >
> > >                 <map:transform type="cinclude"/>
> > >                 <map:transform type="xslt-saxon"
> > > src="style/CreditCardDetails.xsl"/>
> > >                 <map:transform type="cinclude"/>
> > >                 <map:transform type="i18n">
> > >                   <map:parameter name="locale" value="en-US"/>
> > >                 </map:transform>
> > >                 <map:select type="ajax-request">
> > >                   <map:when test="true">
> > >                     <map:serialize type="xml"/>
> > >                   </map:when>
> > >                   <map:otherwise>
> > >                     <map:serialize type="xhtml"/>
> > >                   </map:otherwise>
> > >                 </map:select>
> > >             </map:match>
> > >
> > > when the form is submitted the ajax-request never resolves to true, it
> >
> > > always fails and picks up the xhtml serializer, which leads me to
> > > believe that ajax is not happening, am I right? If so, what could be
> > the
> > > cause of the problem and how do I resolve it? My flow snippet is as
> > > follows:
> > >
> > >     var form = new Form("forms/CreditCardDetails_.xml");
> > >     //Load in credit card page
> > >     form.showForm("viewform-CreditCardDetails",
> > {"userGlobal":userGlobal});
> > >
> > > I gained all the above information from the cocoon wiki concerning
> > ajax
> > > implementation:
> > > http://cocoon.apache.org/2.1/userdocs/ajax.html
> > >
> > > regards
> > >
> > > Andrew
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
>

Mime
View raw message