You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by werner <we...@gefi.at> on 2006/05/03 08:33:52 UTC

Re: jx templates and syntax

I wonder if this is a bug or a feature.

Werner

Danny Bols wrote:

>If you write the following, myVar wil be a collection of dom nodes:
>
><jx:set var="myVar">test</jx:set>
>${myVar.getClass().getName()} -> [Lorg.w3c.dom.Node
>
>To get the text value you should write:
>
>${myVar[0].nodeValue} -> test
>
>--
>Danny
>
>  
>
>>-----Original Message-----
>>From: Kamal Bhatt [mailto:kbhatt@tt.com.au]
>>Sent: vrijdag 10 maart 2006 2:33
>>To: users@cocoon.apache.org
>>Subject: Re: jx templates and syntax
>>
>>
>>
>>Simone Gianni wrote:
>>
>>    
>>
>>>Hi Kamal,
>>>dunno why, nut i always have problems like this in jx. Seems like a 
>>>variable declared with :
>>>
>>><jx:set var="varname">Content</jx:set>
>>>
>>>Takes as value a document fragment, and thus should be converted to 
>>>string or something else to be used "normally".
>>>
>>>      
>>>
>>Really? I found the opposite to be true, at least when I printed 
>>the value.
>>
>>    
>>
>>>I usually declare the variable with :
>>>
>>><jx:set var="varname" value="${whatever.you.need}"/>
>>>
>>>And this (again, usually) works in the expected way.
>>>
>>>Hope this helps,
>>>Simone
>>>
>>>Kamal Bhatt wrote:
>>>
>>>      
>>>
>>>>Hi.
>>>>I was wondering, if this is a bug and if it is,  has been fixed in 
>>>>2.1.8 (I am currently on 2.1.7 and do not have access to 2.1.8):
>>>>
>>>>If I create a variable with value of a field eg.
>>>>
>>>><jx:set var="active_repeater"><jx:out 
>>>>value="${form.getChild('active_repeater').getValue()}"/></jx:set>
>>>>
>>>>then I reference it in an if eg.
>>>>
>>>><jx:if test="${active_repeater == 'validity'}">
>>>>...
>>>>
>>>>I do not enter the code inside of the if but if I change it to this:
>>>><jx:if test="${form.getChild('active_repeater').getValue() == 
>>>>'validity'}">
>>>>
>>>>it works fine.
>>>>
>>>>Also, while we are on the topic of jx templates, why are they so 
>>>>inconsisten with the way we do things in XSLT and XML based 
>>>>        
>>>>
>>"languages".
>>    
>>
>>>>Cheers.
>>>>
>>>>        
>>>>
>> -- 
>>Kamal Bhatt
>>
>>Tourism Technology Pty Ltd
>>
>>
>>T:  +61 (02) 9956 7300
>>F:  +61 (02) 9956 7411
>>
>>
>>Level 10, 1 Pacific Highway, North Sydney, NSW 2060
>>
>> 
>>http://www.tt.com.au
>>
>>
>>--
>>Disclaimer: This email is confidential and may contain privileged 
>>information for the sole use of the person or business to which 
>>it is addressed. If you are not the intended recipient, please 
>>notify the sender by return e-mail or phone as you must not view, 
>>disseminate, distribute or copy this email without our consent. 
>>We do not accept any liability in connection with any computer 
>>virus, data corruption, incompleteness, or unauthorised amendment 
>>of this email. It is the sole responsibility of the receiver to 
>>scan for viruses before opening.
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>
>>    
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org
>
>  
>


RE: jx templates and syntax

Posted by Danny Bols <db...@osirion.be>.
I think it's designed this way...the advantage is that you can assign a
complete xml-fragment to a variable.

Cheers
--
Danny
  -----Original Message-----
  From: werner [mailto:werner@gefi.at]
  Sent: woensdag 3 mei 2006 8:34
  To: users@cocoon.apache.org
  Subject: Re: jx templates and syntax


  I wonder if this is a bug or a feature.

  Werner

  Danny Bols wrote:
If you write the following, myVar wil be a collection of dom nodes:

<jx:set var="myVar">test</jx:set>
${myVar.getClass().getName()} -> [Lorg.w3c.dom.Node

To get the text value you should write:

${myVar[0].nodeValue} -> test

--
Danny

  -----Original Message-----
From: Kamal Bhatt [mailto:kbhatt@tt.com.au]
Sent: vrijdag 10 maart 2006 2:33
To: users@cocoon.apache.org
Subject: Re: jx templates and syntax



Simone Gianni wrote:

    Hi Kamal,
dunno why, nut i always have problems like this in jx. Seems like a
variable declared with :

<jx:set var="varname">Content</jx:set>

Takes as value a document fragment, and thus should be converted to
string or something else to be used "normally".

      Really? I found the opposite to be true, at least when I printed
the value.

    I usually declare the variable with :

<jx:set var="varname" value="${whatever.you.need}"/>

And this (again, usually) works in the expected way.

Hope this helps,
Simone

Kamal Bhatt wrote:

      Hi.
I was wondering, if this is a bug and if it is,  has been fixed in
2.1.8 (I am currently on 2.1.7 and do not have access to 2.1.8):

If I create a variable with value of a field eg.

<jx:set var="active_repeater"><jx:out
value="${form.getChild('active_repeater').getValue()}"/></jx:set>

then I reference it in an if eg.

<jx:if test="${active_repeater == 'validity'}">
...

I do not enter the code inside of the if but if I change it to this:
<jx:if test="${form.getChild('active_repeater').getValue() ==
'validity'}">

it works fine.

Also, while we are on the topic of jx templates, why are they so
inconsisten with the way we do things in XSLT and XML based
        "languages".
    Cheers.

         --
Kamal Bhatt

Tourism Technology Pty Ltd


T:  +61 (02) 9956 7300
F:  +61 (02) 9956 7411


Level 10, 1 Pacific Highway, North Sydney, NSW 2060


http://www.tt.com.au


--
Disclaimer: This email is confidential and may contain privileged
information for the sole use of the person or business to which
it is addressed. If you are not the intended recipient, please
notify the sender by return e-mail or phone as you must not view,
disseminate, distribute or copy this email without our consent.
We do not accept any liability in connection with any computer
virus, data corruption, incompleteness, or unauthorised amendment
of this email. It is the sole responsibility of the receiver to
scan for viruses before opening.

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



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