Skip to content
March 14, 2013 / kiranpatils

Why . is required in script tag within XAML?


This blog post is from my question, which I asked on SDN forum

Basically,Whenever we create our custom XAML# form. We need to add . in script tags and it works fine! For example

Here, you will observe that Ivan Sharamok has used . for script tags, as shown below:

<script type="text/<span class=">// <![CDATA[
javascript</span>" Language="javascript" Src="RadControls/Editor/Scripts/6_5_2/RadWindow.js">.
// ]]></script>
<script type="text/<span class=">// <![CDATA[
javascript</span>" Language="javascript" Src="Controls/Rich Text Editor/Custom Dialog/customdialog.js">.
// ]]></script>

So, if we remove . from Script tag. It will stop working and if we keep it, it works like a charm! We are very happy when it works. But an engineer inside us asked why it works?! And to get answer of this raised it in SDN forum. But haven’t got concrete answer from forum (And it’s obvious as the reason was bit in-depth). So, raised it with Sitecore support guys. And as usual they provided nice explanation for the same. Which I would like to share with you. So, you also know why you have to put . inside your script tags?! 🙂


Reply from Alexandr Povar (Thank you!) – Sitecore support engineer!

I’ve investigated this issue more thoroughly and found the actual reason of such “requirement”.
As you know, the SCRIPT Tag

During the source file’s transformations (xml transformations) the empty script tag will be transformed to self-closing script tag. As the result, the browser will not load it. But if you add a dot, the tag will not be empty and will not be transformed in such way.

Here is a little example:


<script type="text/<span class=">// <![CDATA[
javascript</span>" Language="javascript" Src="/sitecore/shell/Controls/Rich Text Editor/InsertImage/InsertImage.js">.
// ]]></script>

Result with dot:

<script type="text/javascript" src="/sitecore/shell/Controls/Rich Text Editor/<span class=" language="javascript">// <![CDATA[
// ]]></script>

Result without dot:

<script Type="text/javascript" Language="javascript" Src="/sitecore/shell/Controls/Rich Text Editor/InsertImage/InsertImage.js" />

From now you are free to smile each time you insert these weird dots and understand the actual need of their presence 🙂


We still had one question, that who does XML transformation? How our XML file will get compiled to .cs file? And here’s the reply for the same:

After an initial review I can state that the current issue is related to the XAML# part of Sitecore functionality which is an undocumented feature and it falls outside the coverage of the Sitecore Support.

Please feel free to use Sitecore Forum for further inspiration where you can expect to receive a feedback from the Sitecore community.

Also you may use any reverse engineering tool (e.g. Reflector) to examine the sources and realize how it works. Pay attention to the Sitecore.Web.UI.XmlControls.ControlFactory class of the Sitecore.Kernel.dll. The implementation of the ParseControlFile() method should answer you to your question.

So, now each time you add . to script tag in your XAML form. You know the reason behind it!

Happy Sitecoring! 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: