<!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'>&nbsp;</xsl:text>"> <!ENTITY yen "<xsl:text xmlns:xsl='http://www.w3.org/1999/XSL/Transform' disable-output-escaping='yes'>&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 Theoretically   is the non-breaking space character. But in my experience that isn't gauranteed. I have seen   rendered in browsers, with certain character sets, as a visible dot. So I prefer to use techniques such as above to output
<?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>
<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>
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>