You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Carlos Martínez Peña <ca...@uib.es> on 2007/11/02 14:41:16 UTC

Problems with jx and form model in Cocoon 2.1.9

Hello,

I'm using Cocoon 2.1.9 and i have a little problemas with de jx sentences.

I'm developing a dynamic template generator and i need to put some /jx 
if/ in it. I can use this kind of senteces and i have no problem with 
it. But when i try to use /form.getChild/ or /form.loookupWidget /inside 
a test condition the cocoon give me this error:

javax.xml.transform.TransformerException: No se ha podido encontrar la 
función: form.getChild / (Can't find the function: form.getChild)/

Thanks, Carlos.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Problems with jx and form model in Cocoon 2.1.9

Posted by Carlos Martínez Peña <ca...@uib.es>.
Hello Thorsten,

It seems that it work.

Thanks a lot, Carlos.
> On Mon, 2007-11-05 at 09:42 +0100, Thorsten Scherler wrote:
> ...
> > > <jx:if test="${form.getChild('formulari')}">
> > 
> > This is one problem as I see it.
> > 
> > XSL transformer will interpret it as xsl function call. You need to
> > escape it or write it in a different way. E.g. 
> > <jx:if>
> >  <xsl:attribute name="if">
>
> Uuups, should read:
>
> <xsl:attribute name="test">
>
>
> >   ${form.getChild('formulari')}
> >  </xsl:attribute> 
> > </jx:if>
> > 
> > I reckon this way it will work
> > 
> > HTH
> > 
> > salu2
> -- 
> Thorsten Scherler                                 thorsten.at.apache.org
> Open Source Java                      consulting, training and solutions
>  
>


-- 
======================================================================
Carlos Martínez Peña		Centre de Tecnologies de la Informació
tel.: +34 971172887  		Universitat de les Illes Balears
e-mail: carlos.martinez@uib.es	Ctra. de Valldemossa, km 7,5 
				07122 Palma de Mallorca, España
====================================================================== 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Problems with jx and form model in Cocoon 2.1.9

Posted by Thorsten Scherler <th...@juntadeandalucia.es>.
On Mon, 2007-11-05 at 09:42 +0100, Thorsten Scherler wrote:
...
> > <jx:if test="${form.getChild('formulari')}">
> 
> This is one problem as I see it.
> 
> XSL transformer will interpret it as xsl function call. You need to
> escape it or write it in a different way. E.g. 
> <jx:if>
>  <xsl:attribute name="if">

Uuups, should read:

<xsl:attribute name="test">


>   ${form.getChild('formulari')}
>  </xsl:attribute> 
> </jx:if>
> 
> I reckon this way it will work
> 
> HTH
> 
> salu2
-- 
Thorsten Scherler                                 thorsten.at.apache.org
Open Source Java                      consulting, training and solutions


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Problems with jx and form model in Cocoon 2.1.9

Posted by Thorsten Scherler <th...@juntadeandalucia.es>.
On Mon, 2007-11-05 at 08:47 +0100, Carlos Martínez Peña wrote:
> Hello Grzegorz,
> 
> It's dificult to show you some code of my template because it is 
> generate dinamically with a XSLT. I can show you the code of xsl than 
> create the template (the interesting lines).
> 
> -----------------------------------------------------------------------
> 
> *The main of my template (*generarTemplate.xsl*):*
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
> xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
> xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
> xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
> <xsl:import href="../../../../recursos/xsl/global.xsl" />
> <xsl:import href="solicituds-global.xsl" />
> <xsl:output method="xml" indent="yes" media-type="text/html" 
> encoding="UTF-8"
> doctype-system="http://www.w3.org/TR/html4/loose.dtd" 
> doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" />
> 
> 
> <xsl:template match="/">
> <html>
> <jx:import 
> uri="resource://org/apache/cocoon/forms/generation/jx-macros.xml" />
> <head>
> <link type="text/css" rel="stylesheet" 
> href="{$intranet}/recursos/css/solicituds.css" />
> <link type="text/css" rel="stylesheet" 
> href="{$intranet}/recursos/css/yuicalendar.css" />
> <script>djConfig = { bindEncoding: "utf-8" };</script>
> </head>
> <body>
> <xsl:apply-templates select="/SOL_ALTA_SOLICITUD/TIPUS_SOLICITUD" 
> mode="emplenar" />
> </body>
> </html>
> </xsl:template>
> 
> -----------------------------------------------------------------------
> 
> *The xsl:template of the repeater (*generarTemplate.xsl*)*
> 
> <xsl:template match="CAMP" mode="repeater">
> <label for="{@Id}">
> <ft:widget-label id="{@Id}"/>
> </label>
> 
> <ft:repeater id="{@Id}">
> <div>
> <table class="taula" style="width:86%;">
> <tr>
> <xsl:apply-templates select="VALORS/VALOR/CAMPS/CAMP" mode="capcelera" />
> <th align="left">Opcions</th>
> </tr>
> <tbody>
> <ft:repeater-rows>
> <tr>
> <xsl:apply-templates select="VALORS/VALOR/CAMPS/CAMP" mode="columna" />
> <jx:if test="${form.getChild('formulari')}">

This is one problem as I see it.

XSL transformer will interpret it as xsl function call. You need to
escape it or write it in a different way. E.g. 
<jx:if>
 <xsl:attribute name="if">
  ${form.getChild('formulari')}
 </xsl:attribute> 
</jx:if>

I reckon this way it will work

HTH

salu2
-- 
Thorsten Scherler                                 thorsten.at.apache.org
Open Source Java                      consulting, training and solutions


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Problems with jx and form model in Cocoon 2.1.9

Posted by Carlos Martínez Peña <ca...@uib.es>.
Hello Grzegorz,

It's dificult to show you some code of my template because it is 
generate dinamically with a XSLT. I can show you the code of xsl than 
create the template (the interesting lines).

-----------------------------------------------------------------------

*The main of my template (*generarTemplate.xsl*):*

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
<xsl:import href="../../../../recursos/xsl/global.xsl" />
<xsl:import href="solicituds-global.xsl" />
<xsl:output method="xml" indent="yes" media-type="text/html" 
encoding="UTF-8"
doctype-system="http://www.w3.org/TR/html4/loose.dtd" 
doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" />


<xsl:template match="/">
<html>
<jx:import 
uri="resource://org/apache/cocoon/forms/generation/jx-macros.xml" />
<head>
<link type="text/css" rel="stylesheet" 
href="{$intranet}/recursos/css/solicituds.css" />
<link type="text/css" rel="stylesheet" 
href="{$intranet}/recursos/css/yuicalendar.css" />
<script>djConfig = { bindEncoding: "utf-8" };</script>
</head>
<body>
<xsl:apply-templates select="/SOL_ALTA_SOLICITUD/TIPUS_SOLICITUD" 
mode="emplenar" />
</body>
</html>
</xsl:template>

-----------------------------------------------------------------------

*The xsl:template of the repeater (*generarTemplate.xsl*)*

<xsl:template match="CAMP" mode="repeater">
<label for="{@Id}">
<ft:widget-label id="{@Id}"/>
</label>

<ft:repeater id="{@Id}">
<div>
<table class="taula" style="width:86%;">
<tr>
<xsl:apply-templates select="VALORS/VALOR/CAMPS/CAMP" mode="capcelera" />
<th align="left">Opcions</th>
</tr>
<tbody>
<ft:repeater-rows>
<tr>
<xsl:apply-templates select="VALORS/VALOR/CAMPS/CAMP" mode="columna" />
<jx:if test="${form.getChild('formulari')}">
<xsl:call-template name="utils" />
</jx:if>
</tr>
</ft:repeater-rows>
</tbody>
</table>
<p>
<ft:widget id="../addcontact">
<fi:styling tipus="afegir" />
</ft:widget>
<ft:widget id="../removecontacts">
<fi:styling tipus="eliminar" />
</ft:widget>
</p>
</div>
</ft:repeater>
</xsl:template>

-----------------------------------------------------------------------

*And maybe the more interesting code, the sitemap entry. (sitemap.xmap)*

<map:match pattern="mostraForm_*.html">
<map:aggregate element="DOCUMENT_XML">
<map:part src="../../recursos/doc/ETQ_SOLALT.xml" />
<map:part src="cocoon:/template_{1}.src" />
</map:aggregate>
<map:transform type="form" label="form"/>
<map:transform type="i18n" label="i18n">
<map:parameter name="locale" value="ca" />
</map:transform>
<map:transform src="recursos/xsl/forms-solicituds-styling.xsl" />
<map:serialize type="xml" />
</map:match>

<map:match pattern="plantilla_*.src">
<map:generate src="cocoon:/formulari-solicitud_{1}.xml"/>
<map:transform src="recursos/xsl/generarTemplate.xsl" />
<map:serialize type="xml"/>
</map:match>

<map:match pattern="template_*.src">
<map:generate type="jx" src="cocoon:/plantilla_{1}.src"/>
<map:serialize type="xml"/>
</map:match>
-----------------------------------------------------------------------

*The lines in the flow that calls the sitemap (flow.js)*

var form;
var continuar = true;

var p_codtso = cocoon.request.get('p_codtso');
var p_codcan = cocoon.request.get('p_codcan');
form = new Form("cocoon:/form_"+p_codtso+".src");
form.createBinding("cocoon:/binding_"+p_codtso+".src");

var dades = loadDocument 
("cocoon:/dades-solicitud_"+p_codtso+"_"+p_codcan+".src");
form.load(dades);

while (continuar){
form.showForm( "mostraForm_"+p_codtso+".html" );

-------------------------------------------------------------------------

Firts the database return a XML(data.xml) with the interesting data than 
we have to show to the user. Here, we have 3 diferents xsl. One create 
the form definition (generarDefinition.xsl) based in the XML (data.xml). 
The second xsl (generarTemplate.xsl) create the template of the same 
way. And the last create the binding (generarBinding.xsl) with this XML 
(data.xml) and another one xml. And then we apply the same 
transformations of cforms like other typical static cforms.

Thanks, Carlos.

> Carlos Mart�nez Pe�a pisze:
> > Hello,
>
> Hello Carlos.
>
> > I'm using Cocoon 2.1.9 and i have a little problemas with de jx sentences.
> > 
> > I'm developing a dynamic template generator and i need to put some /jx 
> > if/ in it. I can use this kind of senteces and i have no problem with 
> > it. But when i try to use /form.getChild/ or /form.loookupWidget /inside 
> > a test condition the cocoon give me this error:
> > 
> > javax.xml.transform.TransformerException: No se ha podido encontrar la 
> > funci�n: form.getChild / (Can't find the function: form.getChild)/
>
> Could you post relevant snippet of your template so we could make a 
> quick guess on causes of your trouble?
>
> It seems that in context where you use if construct there is no form 
> variable defined for some reason.
>
> -- 
> Grzegorz Kossakowski
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>   
>
>


-- 
======================================================================
Carlos Martínez Peña		Centre de Tecnologies de la Informació
tel.: +34 971172887  		Universitat de les Illes Balears
e-mail: carlos.martinez@uib.es	Ctra. de Valldemossa, km 7,5 
				07122 Palma de Mallorca, España
====================================================================== 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Problems with jx and form model in Cocoon 2.1.9

Posted by Grzegorz Kossakowski <gr...@tuffmail.com>.
Carlos Martínez Peña pisze:
> Hello,

Hello Carlos.

> I'm using Cocoon 2.1.9 and i have a little problemas with de jx sentences.
> 
> I'm developing a dynamic template generator and i need to put some /jx 
> if/ in it. I can use this kind of senteces and i have no problem with 
> it. But when i try to use /form.getChild/ or /form.loookupWidget /inside 
> a test condition the cocoon give me this error:
> 
> javax.xml.transform.TransformerException: No se ha podido encontrar la 
> función: form.getChild / (Can't find the function: form.getChild)/

Could you post relevant snippet of your template so we could make a 
quick guess on causes of your trouble?

It seems that in context where you use if construct there is no form 
variable defined for some reason.

-- 
Grzegorz Kossakowski

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org