コード例 #1
0
ファイル: applyimportsaction.cs プロジェクト: ArildF/masters
 internal override void Compile(Compiler compiler) {
     CheckEmpty(compiler);
     if (! compiler.CanHaveApplyImports) {
         throw new XsltException(Res.Xslt_ApplyImports);                
     }
     this.mode = compiler.CurrentMode;
     this.stylesheet = compiler.CompiledStylesheet;
 }
コード例 #2
0
ファイル: rootaction.cs プロジェクト: ArildF/masters
        public void PorcessAttributeSets(Stylesheet rootStylesheet) {
            MirgeAttributeSets(rootStylesheet);

            // As we mentioned we need to invert all lists.
            foreach (AttributeSetAction attSet in this.attributeSetTable.Values) {
                if (attSet.containedActions != null) {
                    attSet.containedActions.Reverse();
                }
            }

            //  ensures there are no cycles in the attribute-sets use dfs marking method
            CheckAttributeSets_RecurceInList(new Hashtable(), this.attributeSetTable.Keys);
        }
コード例 #3
0
ファイル: compiler.cs プロジェクト: ArildF/masters
 internal Stylesheet PopStylesheet() {
     Debug.Assert(this.stylesheet == this.stylesheets.Peek());
     Stylesheet stylesheet = (Stylesheet) this.stylesheets.Pop();
     this.stylesheet = (Stylesheet) this.stylesheets.Peek();
     return stylesheet;
 }
コード例 #4
0
ファイル: compiler.cs プロジェクト: ArildF/masters
        //
        // Stylesheet management
        //

        internal void PushStylesheet(Stylesheet stylesheet) {
            if (this.stylesheets == null) {
                this.stylesheets = new Stack();
            }
            Debug.Assert(this.stylesheets != null);

            this.stylesheets.Push(stylesheet);
            this.stylesheet = stylesheet;
        }
コード例 #5
0
ファイル: compiler.cs プロジェクト: ArildF/masters
        //
        // The World of Compile
        //

        internal void Compile(NavigatorInput input, XmlResolver xmlResolver) {
            Debug.Assert(this.input == null && this.atoms == null);
            this.xmlResolver = xmlResolver == null ? new XmlUrlResolver() : xmlResolver;

            PushInputDocument(input, input.BaseURI);
            this.rootScope  = this.scopeManager.PushScope();
            this.queryStore = new ArrayList();
            AddSpecialQueries();

            try {
                this.rootStylesheet = new Stylesheet();
                PushStylesheet(this.rootStylesheet);

                Debug.Assert(this.input != null && this.atoms != null);

                try {
                    this.CreateRootAction();
                }
                catch(Exception e) {
                    throw new XsltCompileException(e, this.Input.BaseURI, this.Input.LineNumber, this.Input.LinePosition);
                }

                this.stylesheet.ProcessTemplates();
                this.rootAction.PorcessAttributeSets(this.rootStylesheet);
                this.stylesheet.SortWhiteSpace();
                CompileScript();
                this.rootAction.SortVariables();

                if (this.globalNamespaceAliasTable != null ) {
                    this.stylesheet.ReplaceNamespaceAlias(this);
                    this.rootAction.ReplaceNamespaceAlias(this);
		        }  
	        }
            finally {
                PopInputDocument();
            }

            Debug.Assert(this.rootAction != null);
            Debug.Assert(this.stylesheet != null);
            Debug.Assert(this.queryStore != null);
            Debug.Assert(this.input == null && this.atoms == null);
        }
コード例 #6
0
ファイル: processor.cs プロジェクト: ArildF/masters
 internal void PushTemplateLookup(XPathNodeIterator nodeSet, XmlQualifiedName mode, Stylesheet importsOf) {
     Debug.Assert(this.templateLookup != null);
     this.templateLookup.Initialize(mode, importsOf);
     PushActionFrame(this.templateLookup, nodeSet);
 }
コード例 #7
0
ファイル: xsltransform.cs プロジェクト: ArildF/masters
        internal void LoadCompiledStylesheet(out Stylesheet compiledStylesheet, out XPathExpression[] querylist, out ArrayList queryStore, out RootAction rootAction, XPathNavigator input) {
            //
            // Extract the state atomically
            //
            if (_CompiledStylesheet == null || _QueryStore == null || _RootAction == null) {
                throw new XsltException(Res.Xslt_NoStylesheetLoaded);
            }

            compiledStylesheet  = _CompiledStylesheet;
            queryStore          = _QueryStore;
            rootAction          = _RootAction;
            int queryCount      = _QueryStore.Count;
            querylist           = new XPathExpression[queryCount]; {
                bool canClone = input is DocumentXPathNavigator || input is XPathDocumentNavigator;
                for(int i = 0; i < queryCount; i ++) {
                    XPathExpression query = ((TheQuery)_QueryStore[i]).CompiledQuery;
                    querylist[i] = canClone ? query.Clone() : input.Compile(query.Expression);
                }
            }
        }
コード例 #8
0
ファイル: xsltransform.cs プロジェクト: ArildF/masters
        //
        // Implementation
        //

        private void StoreCompiledStylesheet(Stylesheet compiledStylesheet, ArrayList queryStore, RootAction rootAction) {
            Debug.Assert(queryStore != null);
            Debug.Assert(compiledStylesheet != null);
            Debug.Assert(rootAction != null);

            //
            // Set the new state atomically
            //

           // lock(this) {
                _CompiledStylesheet = compiledStylesheet;
                _QueryStore         = queryStore;
                _RootAction         = rootAction;
            //    }
        }
コード例 #9
0
 internal void Initialize(XmlQualifiedName mode, Stylesheet importsOf) {
     this.mode      = mode;
     this.importsOf = importsOf;
 }
コード例 #10
0
ファイル: rootaction.cs プロジェクト: ArildF/masters
        private void MirgeAttributeSets(Stylesheet stylesheet) {
            // mirge stylesheet.AttributeSetTable to this.AttributeSetTable

            if (stylesheet.AttributeSetTable != null) {
                foreach (AttributeSetAction srcAttSet in stylesheet.AttributeSetTable.Values) {
                    ArrayList srcAttList = srcAttSet.containedActions;
                    AttributeSetAction dstAttSet = (AttributeSetAction) this.attributeSetTable[srcAttSet.Name];
                    if (dstAttSet == null) {
                        dstAttSet = new AttributeSetAction(); {
                            dstAttSet.name             = srcAttSet.Name;
                            dstAttSet.containedActions = new ArrayList();
                        }
                        this.attributeSetTable[srcAttSet.Name] = dstAttSet;
                    }
                    ArrayList dstAttList = dstAttSet.containedActions;
                    // We adding attributes in reverse order for purpuse. In the mirged list most importent attset shoud go last one
                    // so we'll need to invert dstAttList finaly. 
                    if (srcAttList != null) {
                        for(int src = srcAttList.Count - 1; 0 <= src; src --) {
                            // We can ignore duplicate attibutes here.
                            dstAttList.Add(srcAttList[src]);
                        }
                    }
                }
            }

            foreach (Stylesheet importedStylesheet in stylesheet.Imports) {
                MirgeAttributeSets(importedStylesheet);
            }
        }
コード例 #11
0
 internal void Initialize(XmlQualifiedName mode, Stylesheet importsOf)
 {
     this.mode      = mode;
     this.importsOf = importsOf;
 }
コード例 #12
0
ファイル: templatemanager.cs プロジェクト: ArildF/masters
 internal TemplateManager(Stylesheet stylesheet, XmlQualifiedName mode) {
     this.mode       = mode;
     this.stylesheet = stylesheet;
 }