Article ID: 273793
This article was previously published under Q273793
When you return HTML from an XML/XSL transform, you often have to return SCRIPT blocks. For example:
This article describes how you can include the DEFER attribute for the <SCRIPT> tag when you include a script function in an XSL document that is used in a client-side XML/XSL transform.
NOTE: You only need the DEFER attribute when you manually perform the XML/XSL transform in client-side script. You do not need this attribute in a server-side XML transform, or if the transform is performed when navigating to a static XML file that links to the XSL document.
If you do not include the DEFER attribute for the <SCRIPT> tag, and the function is called from the transformed document, an "Object Expected" error occurs.
In addition, you must enclose the SCRIPT block in <xsl:comment> tags and a CDATA section. If you do not wrap the script in a CDATA section, the XML parser parses the contents of the SCRIPT block. Because script can contain reserved characters, such as "<" and ">", the CDATA section protects the parser from potentially invalid XML within the SCRIPT block.
Sample CodeNOTE: Make sure that you save the following files in the same folder.
For more information on the SCRIPT element, see the following Microsoft Developer Network (MSDN) Web site:
http://msdn.microsoft.com/en-us/library/ie/ms535892(v=vs.85).aspxFor more information about Microsoft Windows Script Technologies, see the following MSDN Web site:
http://msdn2.microsoft.com/en-us/library/ms950396.aspxFor more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:
Article ID: 273793 - Last Review: August 1, 2012 - Revision: 4.0