Products

Solutions

Resources

Partners

Community

About

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsXMLXMLXML/XSL Execution of scripts was prohibited - Help!XML/XSL Execution of scripts was prohibited - Help!
Previous
 
Next
New Post
4/11/2011 5:48 PM
 

I'm using DNN 5.6.1 and recently started to use the XML/XSL module more and more to aid updating the site.
One XSL script I've created needs access to the current system date, which proved more difficult than I ever imagined.

After spending many hours trying to resolve this issue, I noticed that script could be added to an xsl stylesheet, so I implemented the following:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:user="urn:my-scripts">
<msxsl:script language="JScript" implements-prefix="user">
function today()
{
return new Date();
}
</msxsl:script>
<xsl:value-of select="user:today()"/>

This looked like it would do the trick, but when I ran it I got the following error:

Execution of scripts was prohibited. Use the XsltSettings.EnableScript property to enable it.

I noticed this was discussed many years ago, but I have not been able to find a resolution.
Does anybody know how to solve this issue with DNN 5.6.1. or how I can get access to the current date within my stylessheet.

Many thanks

Steve
 
New Post
4/12/2011 5:24 AM
 
Execution of scripts is still prohibited, however XML 6.0.0 (currently in release tracker) allows to query context values through TokenReplace.
In your case you would query the token [DateTime:Now]
 
New Post
5/24/2011 8:49 PM
 
Easy 'hack'...

After installing the XML module, go to your DNN' installation App_Code/XML/Components folder

Edit XmlController.vb

Replace this function...

Protected Function GetXslTransform() As XslCompiledTransform
            Dim xslsrc As String = CStrN(Settings(Setting.TransUrl))
            If xslsrc <> "" Then
                If GetURLType(xslsrc) = Entities.Tabs.TabType.Url Then
                    Return Utils.GetXSLContent(xslsrc)
                Else
                    Dim trans As New XslCompiledTransform
     Dim settings As New XsltSettings
                    settings.EnableDocumentFunction = True
                    settings.EnableScript = True

                    trans.Load(GetMappedPath(xslsrc), settings, Nothing)
                    Return trans
                End If
            End If
            Return Nothing
        End Function

 
New Post
2/27/2015 2:50 PM
 

Reheating this old thread as I'm in the middle of a project based on XML module 6.0.2 in DNN 7.4 tested in Visual Studio where all works fine but when after moving the XML and XSLT files to the XML module I was hit by the "scripts are prohibited" error. I have a js script embedded in XSLT.

So my questions are:

1. how one should go about handling testing of the code as VS doesn't recognize DNN tokens? Or am I wrong on this?

2. the hack above can't be used as the module moved from VB to C# and the code file is nowhere to be found. Or is it?

Any reflections are appreciated.


English-Polish translations, one-to-one English/Polish tutoring, Windows server management, website development - HTML/JS/CSS/Razor
 
New Post
3/11/2015 4:51 PM
 

Hi Greg,

are you outputting the script (.js?) from xslt?

does it need to be embedded in the html? or is it a .js  file that you are loading?

if so, the latest .net xslt must have changed something because my old scripts handled outputting &lt; just fine as <  but that doesn't work now.

I have to put into a variable now:

<xsl:variable name="lt">&lt;</xsl:variable> <!-- xsl stopped outputting &lt; right so need this -->
<xsl:variable name="gt">&gt;</xsl:variable>

 and use it like this

 if (index <xsl:value-of select="$lt" disable-output-escaping="yes"/> 0) { index = 1; }; // default tab is 1

<xsl:value-of disable-output-escaping="yes" select="$lt"></xsl:value-of>

 

for loading a .js file, have you tried the Extension object token?

http://dnnxml.codeplex.com/wikipage?t...

 
    <xsl:apply-templates select ="dnnx:registerClientScriptInclude('frameworkX', '/path/to/javascript.js')" />

I have gotten the css token to work (see my post to this thread), but have not tried the script one, trying to figure out what the 'frameworkX' should be replaced with.

 

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsXMLXMLXML/XSL Execution of scripts was prohibited - Help!XML/XSL Execution of scripts was prohibited - Help!


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out