On Fri, 2009-07-24 at 03:15 -0700, Frank Hamilton wrote:
> Hi,
> 
> I am trying to passed a parameter into a javascript  variable inside a xsl
> file.
> 
> in my xsl file I do that:
> 
> <xsl:param name="publication-id"/>
> <xsl:param name="area"/>
>       
> <xsl:variable name="root" select="concat($publication-id, '/', $area)"/>
> 
> Then in  the javascript inside xsl :
> 
>  <script      type="text/javascript" charset="UTF-8"> 
>               var root='<xsl:value-of select="$root"/>';
>               var root2='<xsl:value-of select="$root"/>';
>                                                       
>                alert('root : '+root);
>                alert('root2 : '+root2);
>    
> <![CDATA[
> 
>     
> 
>      function prueba(){
>          alert('root en metodo: '+root);
>        alert('root2 en metodo: '+root2);
>      }
> 
> 
> For the path /pub-id/area/CU.html, all the alert show the same:
> "pub-id/area" , but for the path /pub-id/area/CU/expo/index.html all the
> alert show "pub-id/area" except the alert inside javascript funcion (
> alert('root en metodo: '+root)) that show  " /pub-id/area/" .
> 

Hmm, I have to admit I did not understand. As I understand the above
code the 2 alerts should be always the same, right?

Meaning the expected behavior is root=root2.

So the error you see is the trailing slash on the end with alert('root
en metodo: '+root);, right? I mean expected is '/pub-id/area' but it
shows '/pub-id/area/'.

Hmm, weird. Try the following for debug without the surrounding CDATA:

function prueba(){
alert('hack: <xsl:value-of select="concat($publication-id, '/',
$area)"/>');
alert('root en metodo: '+root);


> you have any idea why this happens, thanks.

Not really, really strange, are you sure that in between the call you
are not adding a '/' somewhere which does not explain why the second
call does not contain it anymore. 

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

Sociedad Andaluza para el Desarrollo de la Sociedad 
de la Información, S.A.U. (SADESI)





---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to