Which scripting languages are available in msxml4.dll xsl transforms?
I am working on an native application that uses msxml4.dll for all xml related work where I need to add xsl transformations开发者_运维知识库. I need <msxsl:script language="...."
scripts for the xsl.
Which scripting languages (C#, JScript, VBScript,...) are available to me if I call these xsl transforms from native code using the MSXML2 namespace? Can I use C# as I could when using the managed xml classes from System.Xml?
As far as I understand it, you can use the JScript and the VBScript language with MSXML and msxsl:script. Other languages are possible if they implement the ActiveX scripting engine interfaces http://msdn.microsoft.com/en-us/library/xawadt95%28v=VS.85%29.aspx. I think there used to be a PerlScript third party scripting engine for instance but I don't know whether it still exists.
C# is a .NET language that I am sure is not supported with MSXML and msxsl:script.
I have used JScript/WScript (same syntax) on a local XP with MSXML 4.0. Works perfectly. If you need inspiration, I have used MSXSL.exe as console transfom - I use this for math and crono.
like this:
<line id="hrHand" stroke-width="4" x2="1000" y2="1000" marker-start="url(#hrPointer)">
<xsl:attribute name="x1"><xsl:value-of select="1000-crono:returnX(12) * 200" /></xsl:attribute>
<xsl:attribute name="y1"><xsl:value-of select="1000-crono:returnY(12) * 200" /></xsl:attribute>
</line>
</g>
<g>
<line id="secHand" stroke-width="4" x2="1000" y2="1000" marker-start="url(#secPointer)">
<xsl:attribute name="x1"><xsl:value-of select="1000-crono:returnX(12) * 380" /></xsl:attribute>
<xsl:attribute name="y1"><xsl:value-of select="1000-crono:returnY(12) * 380" /></xsl:attribute>
</line>
</g>
<g font-family="sans-serif" font-size="64" font-weight="100">
<circle r="50" cx="1000" cy="1000" fill="#a00000" />
<text fill="#e0e0e0" text-anchor="middle" x="1000" y="1260">CLOCK BY M.RASCH</text>
</g>
</svg>
</xsl:template>
<!-- r u n t i m e S c r i p t -->
<msxsl:script language="JScript" implements-prefix="crono">
function returnX(degree) {
return Math.cos(degree*Math.PI/180);
}
function returnY(degree) {
return Math.sin(degree*Math.PI/180);
}
</msxsl:script>
精彩评论