public bool ApplyTransform(string sConfigurationPath, string sSourceFile) { if (!String.IsNullOrEmpty(ApplyTransformWhenXPath)) { if (null == GetResultFromAnswerFile(ApplyTransformWhenXPath)) { return(false); } } string sResultFile = ResultFile; if (sResultFile != null) { XMLUtilities.XSLParameter[] parameterList = Parameters; if (parameterList != null) { foreach (XMLUtilities.XSLParameter parameter in parameterList) { if (parameter.Name == "prmSVersionNumber") { parameter.Value = m_sVersionNumber; } } } m_transform.TransformFileToFile(parameterList, sSourceFile, sResultFile); DoAnyCleanup(sResultFile); } else { try { XmlNode node = m_xdAnswers.SelectSingleNode("//langAbbr"); string sLanguageAbbreviation = node.InnerText; foreach (XMLUtilities.XSLParameter[] parameters in ParameterSet) { sResultFile = BuildResultFileName(sLanguageAbbreviation, parameters); m_transform.TransformFileToFile(parameters, sSourceFile, sResultFile); DoAnyCleanup(sResultFile); } } catch (Exception exc) { throw new Exception("When using 'resultPathFromAnswerFile', the resultFile1 and resultFile2 attributes must be specified and, also, one must use <xsltParameterSets>", exc.InnerException); } } return(true); }
public void TransformXmlPageDescription(string sXmlFile, out string sHtmlFile) { string sTemp = m_sConfigurationPath + "/XmlPageDescriptions/" + sXmlFile; XMLUtilities.XSLParameter[] parameterList = GetTransformParameters(); sHtmlFile = Path.Combine(m_sHtmsPath, Path.GetFileNameWithoutExtension(sXmlFile)); sHtmlFile += ".htm"; //MessageBox.Show("TransformXmlPageDescription: m_sWebPageMapper = " + m_sWebPageMapper); //MessageBox.Show("XmlPageDescription = " + sTemp); //MessageBox.Show("HtmlFile = " + sHtmlFile); m_transform.TransformFileToFile(parameterList, sTemp, sHtmlFile); //MessageBox.Show("After TransformFileToFile()"); }
public void ApplyTransform(string sSourceFile) { string sTransformFile = TransformFile; #if UsingDotNetTransforms m_transform = new DotNetCompiledTransform(m_sTransformFile, "en"); #endif #if UsingSaxonDotNetTransforms m_transform = new SaxonDotNetTransform(m_sTransformFile, "en"); #endif #if UsingMSXML2Transforms m_transform = new MSXML2Transform(m_sTransformFile, "en"); #endif string sResultFile = Path.GetTempFileName(); m_transform.TransformFileToFile(sSourceFile, sResultFile); File.Copy(sResultFile, sSourceFile, true); File.Delete(sResultFile); }