public AnswerFileTransform(string sAnswerFile, XmlNode transformConfigurationNode, string sConfigurationPath, string sVersionNumber) { AnswerFile = sAnswerFile; m_sVersionNumber = sVersionNumber; m_sTransformFile = XmlUtils.GetManditoryAttributeValue(transformConfigurationNode, "file"); m_sTransformFile = sConfigurationPath + "/" + m_sTransformFile; m_sResultFileAnswerFileXPath = XmlUtils.GetOptionalAttributeValue(transformConfigurationNode, "resultFileFromAnswerFile"); m_sResultPathAnswerFileXPath = XmlUtils.GetOptionalAttributeValue(transformConfigurationNode, "resultPathFromAnswerFile"); m_sFileExtension = XmlUtils.GetOptionalAttributeValue(transformConfigurationNode, "ext", null); m_sResultFile1 = XmlUtils.GetOptionalAttributeValue(transformConfigurationNode, "resultFile1", null); m_sResultFile2 = XmlUtils.GetOptionalAttributeValue(transformConfigurationNode, "resultFile2", null); m_sReplaceDOCTYPE = XmlUtils.GetOptionalAttributeValue(transformConfigurationNode, "replaceDOCTYPE", null); m_fRemoveBOM = XmlUtils.GetBooleanAttributeValue(transformConfigurationNode, "removeBOM"); m_fSaveResult = XmlUtils.GetBooleanAttributeValue(transformConfigurationNode, "saveResult", "true"); m_sApplyTransformWhenXPath = XmlUtils.GetOptionalAttributeValue(transformConfigurationNode, "applyTransformWhenXPath", null); m_fInsertConfigPathInTransformDOCTYPE = XmlUtils.GetBooleanAttributeValue(transformConfigurationNode, "insertConfigPathInTransformDOCTYPE"); if (m_fInsertConfigPathInTransformDOCTYPE) { AdjustDoctypePath(sConfigurationPath); } SetUpXSLTParameters(transformConfigurationNode); string sLanguageCode = XmlUtils.GetOptionalAttributeValue(transformConfigurationNode, "lang", "en"); #if UsingDotNetTransforms m_transform = new DotNetCompiledTransform(m_sTransformFile, sLanguageCode); #endif #if UsingSaxonDotNetTransforms m_transform = new SaxonDotNetTransform(m_sTransformFile, sLanguageCode); #endif #if UsingMSXML2Transforms m_transform = new MSXML2Transform(m_sTransformFile, sLanguageCode); #endif }
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); }
public void Init(Mediator mediator, XmlNode configurationParameters) { m_mediator = mediator; m_configurationParameters = configurationParameters; ConfigurationPath = GetConfigurationPath(configurationParameters.BaseURI); m_sUserAnswerFile = mediator.PropertyTable.GetStringProperty(m_ksAnswerFileKey, null); m_sMasterAnswerFile = GetPropertyValueAsPath("MasterAnswerFileLocation"); m_sStylesheet = GetPropertyValueAsPath("MasterCSSLocation"); m_sWebPageMapper = GetPropertyValueAsPath("WebPageMapperLocation"); string sLanguageCode = XmlUtils.GetOptionalAttributeValue(configurationParameters, "lang", "en"); #if UsingDotNetTransforms m_transform = new DotNetCompiledTransform(m_sWebPageMapper, sLanguageCode); #endif #if UsingSaxonDotNetTransforms m_transform = new SaxonDotNetTransform(m_sWebPageMapper, sLanguageCode); #endif #if UsingMSXML2Transforms m_transform = new MSXML2Transform(m_sWebPageMapper, sLanguageCode); #endif m_sAnswerFileFilter = mediator.PropertyTable.GetStringProperty("AnswerFileFilter", null); }