1<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 2 xmlns:msxsl="urn:schemas-microsoft-com:xslt" 3 xmlns:user ="USER" 4 xmlns:a ="USER_A" 5 xmlns:b ="USER_B" 6 xmlns:c ="USER_C" 7 8 xmlns:userC="http://mycompany.com/mynamespace_CSharp" 9 xmlns:userJ="http://mycompany.com/mynamespace_JScript" 10 xmlns:userVB="http://mycompany.com/mynamespace_VB" 11 12 xmlns:bk='urn:loc.gov:books' 13 version="1.0"> 14 <xsl:output method="xml" indent="yes" omit-xml-declaration="no" encoding="utf-8" version="1.0"/> 15 <msxsl:script language="c#" implements-prefix="userC"> 16 <msxsl:using namespace="System.Threading" /> 17 <msxsl:using namespace="System.IO" /> 18 public int writetofile(string path,string s) 19 { 20 System.IO.StreamWriter sw = new StreamWriter(path); 21 sw.WriteLine(s); 22 sw.Close(); 23 return 1; 24 } 25 </msxsl:script> 26 27 28 <msxsl:script language="jscript" implements-prefix="userJ"> 29 <msxsl:using namespace="System.Threading" /> 30 <msxsl:using namespace="System.IO" /> 31 32 function writetofile(path, str) 33 { 34 var fso, f1 35 fso = new ActiveXObject("Scripting.FileSystemObject"); 36 f1 = fso.CreateTextFile(path, true); 37 // Write a line. 38 f1.WriteLine(str); 39 f1.Close(); 40 return 2; 41 } 42 </msxsl:script> 43 <msxsl:script language="VISUALBASIC" implements-prefix="userVB"> 44 <msxsl:using namespace="System.Threading" /> 45 <msxsl:using namespace="System.IO" /> 46 Function writetofile(ByVal path As String,ByVal mystr As String) As Integer 47 Dim sw As StreamWriter = New StreamWriter(path) 48 sw.WriteLine(mystr) 49 sw.Close() 50 return 3 51 End Function 52 </msxsl:script> 53 <xsl:template match="/"> 54 <xsl:variable name="path1" select="'C:\testsecurity\charpfile.xml'"></xsl:variable> 55 <xsl:variable name="mystr" select="'hello world'"></xsl:variable> 56 <xsl:variable name="myvar1" select="userC:writetofile($path1,$mystr)" /> 57 <xsl:variable name="path2" select="'C:\testsecurity\jscriptfile.xml'"></xsl:variable> 58 <xsl:variable name="myvar2" select="userJ:writetofile($path2,$mystr)" /> 59 <xsl:variable name="path3" select="'C:\testsecurity\vbfile.xml'"></xsl:variable> 60 <xsl:variable name="myvar3" select="userVB:writetofile($path3,$mystr)" /> 61 <xsl:element name="result"> 62 <xsl:value-of select="concat($myvar1,$myvar2,$myvar3)"/> 63 </xsl:element> 64 </xsl:template> 65</xsl:stylesheet> 66