You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lenya.apache.org by Renaud Richardet <re...@gmail.com> on 2005/06/15 12:06:06 UTC

Embed javascript in xsl: > problem

Bonjour,

I'm trying to embed some javascript in 
${mypub}/lenya/xslt/authoring/create.xsl
There is already some script, which works fine, but now I would like to 
limit the length of the textareas.

This is my try:

function validLength(formField,fieldLabel, maxLength) {
  if (formField.value.length > 3) {
        alert('ohoh!');
    formField.focus();
    return false;
  }
  return true;
}

My problem is that the > sign gets mixed-up as it passes through the 
numerous xsl's (at least 4 of them)

So far, I have 2 solutions, but they don't satisfy me:

1) <TEXTAREA onkeyup="this.value = this.value.slice(0, 20)"></TEXTAREA>

2) externalize the javascript in a .js file and put it under /ressources

Anybody faced this already and has a solution?

Thanks,
Renaud

-- 
Renaud Richardet
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
renaud.richardet@wyona.com                   http://www.wyona.com


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: Embed javascript in xsl: > problem

Posted by Renaud Richardet <re...@wyona.com>.
Manos,

Thanks for your response.

Emmanouil Batsis wrote:

> Renaud Richardet wrote:
>
>> My problem is that the > sign gets mixed-up as it passes through the 
>> numerous xsl's (at least 4 of them)
>
>
>
> If the source XML has the character in the form of an entity (&gt;) 
> there should be no problem as that is exactly how the XSLTProcessor 
> outputs it (if the output method is XML)

I forgot to say that I tried that. You are right: the XSLT processor 
outputs it as entity. Unfortunately, the javascript doesn't work.

> 2) externalize the javascript in a .js file and put it under /ressources
>
>
> On the other hand, this is the preffered solution ;-)

Yes, that's what I might end up with, but a quickier solution would be 
nice ;-)

Thanks,
Renaud

-- 
Renaud Richardet
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
renaud.richardet@wyona.com                   http://www.wyona.com


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: Embed javascript in xsl: > problem

Posted by Emmanouil Batsis <Em...@eurodyn.com>.
Renaud Richardet wrote:

> My problem is that the > sign gets mixed-up as it passes through the 
> numerous xsl's (at least 4 of them)


If the source XML has the character in the form of an entity (&gt;) 
there should be no problem as that is exactly how the XSLTProcessor 
outputs it (if the output method is XML)


> 2) externalize the javascript in a .js file and put it under /ressources


On the other hand, this is the preffered solution ;-)

Manos

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org