Search

Hi All,

I am new to XSLT and have been having a major problem while trying to implement a script into one of my Symphony pages.

I have been trying to add a javascript chess board (http://code.google.com/p/pgn4web/) and no matter what I try and change to try and get it to work it keeps giving me XSLT errors. It seems to be a problem with some of the lines of the javascript. Yet if I try and run it in a normal html file it is fine.

Can anyone help?

How does your XSL look like?

I insert a master template which call the js file and the css file for the chess board. Which seems fine. Then in the actual page XLS file there is also some javascript.

This is the section of javascript that seems to be giving the problem with the XLS.

function gup( name ){ name = name.replace(/[[]/,”\[”).replace(/[]]/,”\]”); var regexS = “[\?&]”+name+”=([^&#])”;
regexS = regexS+”(?!.
“+regexS+”)”; // matches the LAST occurrence var regex = new RegExp( regexS ); var results = regex.exec( window.location.href ); if( results === null ) { return “”; } else { return results[1]; } }

If you need JavaScript in the page’s XSLT, I’d go with CDATA blocks, as mentioned in those threads:

<script  type="text/javascript">
    <![CDATA[
        alert('huiui');
    ]]>
&lt;/script>

You may switch between CDATA blocks and XSLT by closing and opening CDATA blocks in your code, like so:

&lt;script>
    <![CDATA[
        alert(']]><xsl:text>Current page: </xsl:text>
        <xsl:value-of select="$current-page"/><![CDATA[');
    ]]>
&lt;/script>

Sorry for those &lt; entities!!! It’s the forum logic…

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details