Including a DTD in an external file

<!DOCTYPE xsl:stylesheet SYSTEM "application.dtd">

Example of contents of application.dtd:

<!ENTITY nbsp "<xsl:text xmlns:xsl='http://www.w3.org/1999/XSL/Transform' disable-output-escaping='yes'>&amp;nbsp;</xsl:text>">
<!ENTITY yen "<xsl:text xmlns:xsl='http://www.w3.org/1999/XSL/Transform' disable-output-escaping='yes'>&amp;yen;</xsl:text>">
<!ENTITY VARName "100">
<!ENTITY aboutus SYSTEM "include.xml">

To use this with MSXML you may need the following settings on the DOM Object before loading the file:

MSXMLDOcument.resolveExternals = true
MSXMLDOcument.validateOnParse = false

A note on &nbsp; Theoretically &#160; is the non-breaking space character. But in my experience that isn't gauranteed. I have seen &#160; rendered in browsers, with certain character sets, as a visible dot. So I prefer to use techniques such as above to output &nbsp;

XML Schema without targeting a namespace

<?xml version="1.0"?>
<doc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="validate.xsd">
	<left>
		<info alpha="content" beta="content"/>
		<info alpha="content" beta="content"/>
		<info alpha="content"/>
	</left>
	<right>
		<info alpha="content" beta="content"/>
		<info alpha="content" beta="content"/>
		<info alpha="content"/>	
	</right>
</doc>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:element name="doc">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="left" type="direction"/>
				<xs:element name="right" type="direction"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:complexType name="direction">
		<xs:sequence>
			<xs:element name="info" minOccurs="1" maxOccurs="unbounded">
				<xs:complexType>
					<xs:attribute name="alpha" type="xs:string" use="required" />
					<xs:attribute name="beta" type="xs:string" use="optional" />			
				</xs:complexType>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
</xs:schema>

Extending XSLT with Javascript (MSXML Only)

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
                xmlns:dyn="http://puna.net.nz/xmlns/dynamic"
                xmlns:msxsl="urn:schemas-microsoft-com:xslt"
                extension-element-prefixes="dyn msxsl">

	<msxsl:script implements-prefix="dyn" language="jscript">
	   function bitAnd(flags, map) {return(flags & map)}
	</msxsl:script>

	<xsl:template name="example">
		<xsl:param name="flags"><xsl:value-of select="dyn:bitAnd(number(@somedata), number($bitmap))"/></xsl:param>
		<!-- do something with $flags -->
	</xsl:template>
</xsl:stylesheet>

XSLT Summing of sums using a node-set (MSXML Only)

This requires using the urn:schemas-microsoft-com:xslt namespace as above.

<xsl:template name="total">
	<xsl:param name="sums">
		<xsl:for-each select=".//item">
			<sum>
				<xsl:value-of select="@quantity @value"/>
			</sum>
		</xsl:for-each>
	</xsl:param>
	<xsl:variable name="formatted">
		<xsl:value-of select="format-number(sum(msxsl:node-set($prices)/sum), '#,##0.00')"/>
	</xsl:variable>
	<xsl:value-of select="$formatted"/>
</xsl:template>