internal override bool CompileAttribute(Compiler compiler) { string name = compiler.Input.LocalName; string value = compiler.Input.Value; if (Keywords.Equals(name, compiler.Atoms.Select)) { this.select = value; this.selectKey = compiler.AddQuery(this.select); Debug.WriteLine("apply-templates select: \"" + this.select + "\" (#" + this.selectKey.ToString() + ")"); } else if (Keywords.Equals(name, compiler.Atoms.Mode)) { Debug.Assert(this.mode == null); if (compiler.AllowBuiltInMode && value.Trim() == "*") { this.mode = Compiler.BuiltInMode; } else { this.mode = compiler.CreateXPathQName(value); } Debug.WriteLine("mode attribute found: \"" + this.mode + "\""); } else { return(false); } return(true); }
internal override bool CompileAttribute(Compiler compiler) { string name = compiler.Input.LocalName; string value = compiler.Input.Value; if (Keywords.Equals(name, compiler.Atoms.Select)) { this.selectKey = compiler.AddQuery(value); } else if (Keywords.Equals(name, compiler.Atoms.Lang)) { this.langAvt = Avt.CompileAvt(compiler, value); } else if (Keywords.Equals(name, compiler.Atoms.DataType)) { this.dataTypeAvt = Avt.CompileAvt(compiler, value); } else if (Keywords.Equals(name, compiler.Atoms.Order)) { this.orderAvt = Avt.CompileAvt(compiler, value); } else if (Keywords.Equals(name, compiler.Atoms.CaseOrder)) { this.caseOrderAvt = Avt.CompileAvt(compiler, value); } else { return(false); } return(true); }
internal override bool CompileAttribute(Compiler compiler) { string name = compiler.Input.LocalName; string value = compiler.Input.Value; if (Keywords.Equals(name, compiler.Atoms.Name)) { Debug.Assert(this.name == null && this.nameStr == null); this.nameStr = value; this.name = compiler.CreateXPathQName(this.nameStr); Debug.WriteLine("name attribute found: " + this.name); } else if (Keywords.Equals(name, compiler.Atoms.Select)) { Debug.Assert(this.select == null); this.select = value; this.selectKey = compiler.AddQuery(this.select); Debug.WriteLine("select attribute = \"" + this.select + "\" (#" + this.selectKey + ")"); } else { return(false); } return(true); }
private void FixupMatch(Compiler compiler, AstNode node) { Debug.Assert(node.TypeOfAst != AstNode.QueryType.Operator, "Right operand should be path or filter"); this.match = XPathComposer.ComposeXPath(node); this.matchKey = compiler.AddQuery(this.match); this.priority = node.DefaultPriority; }
internal override bool CompileAttribute(Compiler compiler) { string name = compiler.Input.LocalName; string value = compiler.Input.Value; if (Keywords.Equals(name, compiler.Atoms.Level)) { if (value != s_any && value != s_multiple && value != s_single) { throw XsltException.InvalidAttrValue(Keywords.s_Level, value); } this.level = value; } else if (Keywords.Equals(name, compiler.Atoms.Count)) { this.countPattern = value; this.countKey = compiler.AddPatternQuery(value, /*allowVars:*/ true, /*allowKey:*/ true); } else if (Keywords.Equals(name, compiler.Atoms.From)) { this.from = value; this.fromKey = compiler.AddPatternQuery(value, /*allowVars:*/ true, /*allowKey:*/ true); } else if (Keywords.Equals(name, compiler.Atoms.Value)) { this.value = value; this.valueKey = compiler.AddQuery(value); } else if (Keywords.Equals(name, compiler.Atoms.Format)) { this.formatAvt = Avt.CompileAvt(compiler, value); Debug.WriteLine("name = \"" + value + "\""); } else if (Keywords.Equals(name, compiler.Atoms.Lang)) { this.langAvt = Avt.CompileAvt(compiler, value); Debug.WriteLine("name = \"" + value + "\""); } else if (Keywords.Equals(name, compiler.Atoms.LetterValue)) { this.letterAvt = Avt.CompileAvt(compiler, value); Debug.WriteLine("name = \"" + value + "\""); } else if (Keywords.Equals(name, compiler.Atoms.GroupingSeparator)) { this.groupingSepAvt = Avt.CompileAvt(compiler, value); Debug.WriteLine("name = \"" + value + "\""); } else if (Keywords.Equals(name, compiler.Atoms.GroupingSize)) { this.groupingSizeAvt = Avt.CompileAvt(compiler, value); Debug.WriteLine("name = \"" + value + "\""); } else { return(false); } return(true); }
internal override void Compile(Compiler compiler) { Debug.Assert(!IsBuiltInAction); CompileAttributes(compiler); CompileContent(compiler); if (this.sort && this.selectKey == Compiler.InvalidQueryKey){ this.select = "child::node()"; this.selectKey = compiler.AddQuery(this.select); } }
private void FinishClone(Compiler compiler, AstNode node) { string expression = XPathComposer.ComposeXPath(node); Debug.WriteLine("Split expression: \"" + expression + "\""); this.match = expression; this.matchKey = compiler.AddQuery(this.match); this.priority = node.DefaultPriority; }
internal override void Compile(Compiler compiler) { Debug.Assert(!IsBuiltInAction); CompileAttributes(compiler); CompileContent(compiler); if (this.sort && this.selectKey == Compiler.InvalidQueryKey) { this.select = "child::node()"; this.selectKey = compiler.AddQuery(this.select); } }
internal void CompileKey(Compiler compiler) { NavigatorInput input = compiler.Input; string element = input.LocalName; int MatchKey = Compiler.InvalidQueryKey; int UseKey = Compiler.InvalidQueryKey; XmlQualifiedName Name = null; if (input.MoveToFirstAttribute()) { do { Debug.TraceAttribute(input); string nspace = input.NamespaceURI; string name = input.LocalName; string value = input.Value; if (!Keywords.Equals(nspace, input.Atoms.Empty)) { continue; } if (Keywords.Equals(name, input.Atoms.Name)) { Name = compiler.CreateXPathQName(value); } else if (Keywords.Equals(name, input.Atoms.Match)) { MatchKey = compiler.AddPatternQuery(value, /*allowVars:*/ false, /*allowKey*/ false); } else if (Keywords.Equals(name, input.Atoms.Use)) { UseKey = compiler.AddQuery(value, /*allowVars:*/ false, /*allowKey*/ false); } else { if (!compiler.ForwardCompatibility) { throw XsltException.InvalidAttribute(element, name); } } }while(input.MoveToNextAttribute()); input.ToParent(); } CheckRequiredAttribute(compiler, MatchKey != Compiler.InvalidQueryKey, Keywords.s_Match); CheckRequiredAttribute(compiler, UseKey != Compiler.InvalidQueryKey, Keywords.s_Use); CheckRequiredAttribute(compiler, Name != null, Keywords.s_Name); compiler.InsertKey(Name, MatchKey, UseKey); }
internal override bool CompileAttribute(Compiler compiler) { string name = compiler.Input.LocalName; string value = compiler.Input.Value; if (Keywords.Equals(name, compiler.Atoms.Select)) { this.select = value; this.selectKey = compiler.AddQuery(this.select); Debug.WriteLine("Select expression == \"" + this.select + "\" + (#" + this.selectKey + ")"); } else { return false; } return true; }
internal void AddSpace(Compiler compiler, String query, double Priority, bool PreserveSpace) { WhitespaceElement elem; if (this.queryKeyTable != null) { if (this.queryKeyTable.Contains(query)) { elem = (WhitespaceElement) this.queryKeyTable[query]; elem.ReplaceValue(PreserveSpace); return; } } else{ this.queryKeyTable = new Hashtable(); this.whitespaceList = new ArrayList(); } int key = compiler.AddQuery(query); elem = new WhitespaceElement(key, Priority, PreserveSpace); this.queryKeyTable[query] = elem; this.whitespaceList.Add(elem); }
internal override bool CompileAttribute(Compiler compiler) { string name = compiler.Input.LocalName; string value = compiler.Input.Value; if (Keywords.Equals(name, compiler.Atoms.Select)) { this.select = value; this.selectKey = compiler.AddQuery(this.select); Debug.WriteLine("Select expression == \"" + this.select + "\" + (#" + this.selectKey + ")"); } else { return(false); } return(true); }
internal override bool CompileAttribute(Compiler compiler) { string name = compiler.Input.LocalName; string value = compiler.Input.Value; if (Keywords.Equals(name, compiler.Atoms.Select)) { this.select = value; //this.selectKey = compiler.AddStringQuery(this.select); this.selectKey = compiler.AddQuery(this.select); Debug.WriteLine("value-of select = \"" + this.select + "\" (#" + this.selectKey + ")"); } else if (Keywords.Equals(name, compiler.Atoms.DisableOutputEscaping)) { this.disableOutputEscaping = compiler.GetYesNo(value); } else { return false; } return true; }
internal override void Compile(Compiler compiler) { CompileAttributes(compiler); CheckEmpty(compiler); if (selectKey == Compiler.InvalidQueryKey) { selectKey = compiler.AddQuery(Compiler.SelfQuery); } this.forwardCompatibility = compiler.ForwardCompatibility; this.manager = compiler.CloneScopeManager(); this.lang = ParseLang(PrecalculateAvt(ref this.langAvt)); this.dataType = ParseDataType(PrecalculateAvt(ref this.dataTypeAvt), manager); this.order = ParseOrder(PrecalculateAvt(ref this.orderAvt)); this.caseOrder = ParseCaseOrder(PrecalculateAvt(ref this.caseOrderAvt)); if (this.langAvt == null && this.dataTypeAvt == null && this.orderAvt == null && this.caseOrderAvt == null) { this.sort = new Sort(this.selectKey, this.lang, this.dataType, this.order, this.caseOrder); } }
internal override bool CompileAttribute(Compiler compiler) { string name = compiler.Input.LocalName; string value = compiler.Input.Value; if (Keywords.Equals(name, compiler.Atoms.Select)) { this.select = value; //this.selectKey = compiler.AddStringQuery(this.select); this.selectKey = compiler.AddQuery(this.select); Debug.WriteLine("value-of select = \"" + this.select + "\" (#" + this.selectKey + ")"); } else if (Keywords.Equals(name, compiler.Atoms.DisableOutputEscaping)) { this.disableOutputEscaping = compiler.GetYesNo(value); } else { return(false); } return(true); }
internal void AddSpace(Compiler compiler, String query, double Priority, bool PreserveSpace) { WhitespaceElement elem; if (this.queryKeyTable != null) { if (this.queryKeyTable.Contains(query)) { elem = (WhitespaceElement)this.queryKeyTable[query]; elem.ReplaceValue(PreserveSpace); return; } } else { this.queryKeyTable = new Hashtable(); this.whitespaceList = new ArrayList(); } int key = compiler.AddQuery(query); elem = new WhitespaceElement(key, Priority, PreserveSpace); this.queryKeyTable[query] = elem; this.whitespaceList.Add(elem); }
internal override bool CompileAttribute(Compiler compiler) { string name = compiler.Input.LocalName; string value = compiler.Input.Value; if (Keywords.Equals(name, compiler.Atoms.Select )) { this.select = value; this.selectKey = compiler.AddQuery(this.select); Debug.WriteLine("apply-templates select: \"" + this.select + "\" (#" + this.selectKey.ToString() + ")"); } else if (Keywords.Equals(name, compiler.Atoms.Mode )) { Debug.Assert(this.mode == null); if (compiler.AllowBuiltInMode && value.Trim() == "*") { this.mode = Compiler.BuiltInMode; } else { this.mode = compiler.CreateXPathQName(value); } Debug.WriteLine("mode attribute found: \"" + this.mode + "\""); } else { return false; } return true; }
internal void CompileKey(Compiler compiler){ NavigatorInput input = compiler.Input; string element = input.LocalName; int MatchKey = Compiler.InvalidQueryKey; int UseKey = Compiler.InvalidQueryKey; XmlQualifiedName Name = null; if (input.MoveToFirstAttribute()) { do { Debug.TraceAttribute(input); string nspace = input.NamespaceURI; string name = input.LocalName; string value = input.Value; if (! Keywords.Equals(nspace, input.Atoms.Empty)) continue; if (Keywords.Equals(name, input.Atoms.Name)) { Name = compiler.CreateXPathQName(value); } else if (Keywords.Equals(name, input.Atoms.Match)) { MatchKey = compiler.AddPatternQuery(value, /*allowVars:*/false, /*allowKey*/false); } else if (Keywords.Equals(name, input.Atoms.Use)) { UseKey = compiler.AddQuery(value, /*allowVars:*/false, /*allowKey*/false); } else { if (! compiler.ForwardCompatibility) { throw XsltException.InvalidAttribute(element, name); } } } while(input.MoveToNextAttribute()); input.ToParent(); } CheckRequiredAttribute(compiler, MatchKey != Compiler.InvalidQueryKey, Keywords.s_Match); CheckRequiredAttribute(compiler, UseKey != Compiler.InvalidQueryKey, Keywords.s_Use ); CheckRequiredAttribute(compiler, Name != null , Keywords.s_Name ); compiler.InsertKey(Name, MatchKey, UseKey); }
internal override bool CompileAttribute(Compiler compiler) { string name = compiler.Input.LocalName; string value = compiler.Input.Value; if (Keywords.Equals(name, compiler.Atoms.Name)) { Debug.Assert(this.name == null && this.nameStr == null); this.nameStr = value; this.name = compiler.CreateXPathQName(this.nameStr); Debug.WriteLine("name attribute found: " + this.name); } else if (Keywords.Equals(name, compiler.Atoms.Select)) { Debug.Assert(this.select == null); this.select = value; this.selectKey = compiler.AddQuery(this.select); Debug.WriteLine("select attribute = \"" + this.select + "\" (#" + this.selectKey + ")"); } else { return false; } return true; }
internal override bool CompileAttribute(Compiler compiler) { string name = compiler.Input.LocalName; string value = compiler.Input.Value; if (Keywords.Equals(name, compiler.Atoms.Select)) { this.selectKey = compiler.AddQuery(value); } else if (Keywords.Equals(name, compiler.Atoms.Lang)) { this.langAvt = Avt.CompileAvt(compiler, value); } else if (Keywords.Equals(name, compiler.Atoms.DataType)) { this.dataTypeAvt = Avt.CompileAvt(compiler, value); } else if (Keywords.Equals(name, compiler.Atoms.Order)) { this.orderAvt = Avt.CompileAvt(compiler, value); } else if (Keywords.Equals(name, compiler.Atoms.CaseOrder)) { this.caseOrderAvt = Avt.CompileAvt(compiler, value); } else { return false; } return true; }
internal override void Compile(Compiler compiler) { CompileAttributes(compiler); CheckEmpty(compiler); if (selectKey == Compiler.InvalidQueryKey) { selectKey = compiler.AddQuery(Compiler.SelfQuery); } this.forwardCompatibility = compiler.ForwardCompatibility; this.manager = compiler.CloneScopeManager(); this.lang = ParseLang( PrecalculateAvt(ref this.langAvt )); this.dataType = ParseDataType( PrecalculateAvt(ref this.dataTypeAvt ), manager); this.order = ParseOrder( PrecalculateAvt(ref this.orderAvt )); this.caseOrder = ParseCaseOrder(PrecalculateAvt(ref this.caseOrderAvt)); if(this.langAvt == null && this.dataTypeAvt == null && this.orderAvt == null && this.caseOrderAvt == null) { this.sort = new Sort(this.selectKey, this.lang, this.dataType, this.order, this.caseOrder); } }
internal override bool CompileAttribute(Compiler compiler) { string name = compiler.Input.LocalName; string value = compiler.Input.Value; if (Keywords.Equals(name, compiler.Atoms.Level)) { if (value != s_any && value != s_multiple && value != s_single) { throw XsltException.InvalidAttrValue(Keywords.s_Level, value); } this.level = value; } else if (Keywords.Equals(name, compiler.Atoms.Count)) { this.countPattern = value; this.countKey = compiler.AddPatternQuery(value, /*allowVars:*/true, /*allowKey:*/true); } else if (Keywords.Equals(name, compiler.Atoms.From)) { this.from = value; this.fromKey = compiler.AddPatternQuery(value, /*allowVars:*/true, /*allowKey:*/true); } else if (Keywords.Equals(name, compiler.Atoms.Value)) { this.value = value; this.valueKey = compiler.AddQuery(value); } else if (Keywords.Equals(name, compiler.Atoms.Format)) { this.formatAvt = Avt.CompileAvt(compiler, value); Debug.WriteLine("name = \"" + value + "\""); } else if (Keywords.Equals(name, compiler.Atoms.Lang)) { this.langAvt = Avt.CompileAvt(compiler, value); Debug.WriteLine("name = \"" + value + "\""); } else if (Keywords.Equals(name, compiler.Atoms.LetterValue)) { this.letterAvt = Avt.CompileAvt(compiler, value); Debug.WriteLine("name = \"" + value + "\""); } else if (Keywords.Equals(name, compiler.Atoms.GroupingSeparator)) { this.groupingSepAvt = Avt.CompileAvt(compiler, value); Debug.WriteLine("name = \"" + value + "\""); } else if (Keywords.Equals(name, compiler.Atoms.GroupingSize)) { this.groupingSizeAvt = Avt.CompileAvt(compiler, value); Debug.WriteLine("name = \"" + value + "\""); } else { return false; } return true; }
private void FinishClone(Compiler compiler, AstNode node) { string expression = XPathComposer.ComposeXPath(node); Debug.WriteLine("Split expression: \"" + expression + "\""); this.match = expression; this.matchKey = compiler.AddQuery(this.match); this.priority = node.DefaultPriority; }