示例#1
0
 public Xsl2Processor()
 {
     // Create a Processor instance.
     _processor = new Processor();
     _compiler = _processor.NewXsltCompiler();
     
 }
        public SaxonDotNetTransform(string sTransformName, string sTargetLanguageCode)
            : base(sTargetLanguageCode)
        {
            // Create a Processor instance.
            m_processor = new Processor();
            m_compiler = m_processor.NewXsltCompiler();

            // Load transform from file
            var uri = new Uri(sTransformName);
            var errorList = new List<StaticError>();
            m_compiler.ErrorList = errorList;
            var t = m_compiler.Compile(uri);
            m_transformer = t.Load();
        }
示例#3
0
        private void Init (HttpContext context) {
            AppSettings baseXslt = new AppSettings();
            String xsltUri = context.Server.MapPath(baseXslt.GetSetting("baseTemplate"));
            Uri xUri = new Uri(xsltUri);

            this._Resolver = new XmlUrlResolver();
            this._Resolver.Credentials = CredentialCache.DefaultCredentials;

            this._TemplateStream = (Stream)this._Resolver.GetEntity(xUri, null, typeof(Stream));
            this._Processor = new Processor();
            this._Compiler = _Processor.NewXsltCompiler();
            this._Compiler.BaseUri = xUri;
            this._Template = this._Compiler.Compile(_TemplateStream);
            this._IS_INITIALIZED = true;
        }
示例#4
0
    public void ProcessRequest(HttpContext context) {

      _requestMethod = context.Request.HttpMethod;
      _writer = context.Response.Output;
      _context = context;
      _processor = (Processor)context.Application["processor"];
      _compiler = (XsltCompiler)context.Application["compiler"];
      _serializer = (Serializer)context.Application["serializer"];
      _resolver = (XmlUrlResolver)context.Application["resolver"];
      _globalXsltParams = (Hashtable)context.Application["globalXsltParams"];
      _sessionXsltParams = (Hashtable)context.Application["sessionXsltParams"];
      _requestXsltParams = (Hashtable)context.Application["requestXsltParams"];
      Hashtable xsltParams = new Hashtable();
      foreach (DictionaryEntry param in _globalXsltParams) {
        xsltParams[param.Key] = param.Value;
      }
      foreach (DictionaryEntry param in _sessionXsltParams) {
        xsltParams[param.Key] = param.Value;
      }
      foreach (DictionaryEntry param in _requestXsltParams) {
        xsltParams[param.Key] = param.Value;
      }
      _transformContext = new Context(context, _processor, _compiler, _serializer, _resolver, xsltParams);

      switch (_requestMethod) {

        case "GET": {
            new Transform().Process(_transformContext);
            break;
          }
        case "PUT": {
            new Transform().Process(_transformContext);
            break;
          }
        case "POST": {
            new Transform().Process(_transformContext);
            break;
          }
        case "DELETE": {
            new Transform().Process(_transformContext);
            break;
          }
        default: {
            new Transform().Process(_transformContext);
            break;
          }
      }
    }
示例#5
0
        protected virtual void Dispose(bool disposing)
        {
            if (_disposed)
                return;

            if (disposing)
            {
                // free other managed objects that implement
                // IDisposable only
            }

            // release any unmanaged objects set the object references to null
            _processor = null;
            _compiler = null;
            _transformer = null;

            _disposed = true;
        }
 public XsltTransformationManager
   (
     Processor processor,
     Transform transform,
     XmlUrlResolver resolver,
     Serializer serializer,
     Dictionary<string, XsltTransformer> xsltHashtable,
     Hashtable xmlSourceHashtable,
     Hashtable xdmNodeHashtable,
     Hashtable namedXsltHashtable,
     Hashtable namedXsltETagIndex,
     Hashtable xdmNodeETagIndex,
     Uri baseXsltUri,
     String baseXsltUriHash,
     String baseXsltName
   ) {
     m_baseXsltUri = baseXsltUri;
     m_baseXsltUriHash = baseXsltUriHash;
     m_baseXsltName = baseXsltName;
     m_transform = transform;
     m_xsltHashtable = xsltHashtable;
     m_processor = processor;
     m_compiler = m_processor.NewXsltCompiler();
     m_sourceHashtable = xmlSourceHashtable;
     m_resolver = resolver;
     m_compiler.XmlResolver = m_resolver;
     m_builder = m_processor.NewDocumentBuilder();
     m_serializer = serializer;
     m_xdmNodeHashtable = xdmNodeHashtable;
     m_xdmNodeETagIndex = xdmNodeETagIndex;
     m_namedXsltHashtable = namedXsltHashtable;
     m_namedXsltETagIndex = namedXsltETagIndex;
     _hashAlgorithm = HashAlgorithm.MD5;
     //NOTE: TransformEngine enum PLACEHOLDER FOR FUTURE USE
     m_transformEngine = TransformEngine.SAXON;
 }
示例#7
0
 static ProcessorException WrapCompileException(Exception ex, XsltCompiler compiler)
 {
     return WrapCompileException(ex, compiler.ErrorList);
 }
 public void OneTimeTearDown()
 {
     _compiler = null;
     _processor = null;
 }
 public void OneTimeSetUp()
 {
     _processor = new Processor();
     _compiler = _processor.NewXsltCompiler();
 }