internal override bool CompileAttribute(Compiler compiler) { string name = compiler.Input.LocalName; string value = compiler.Input.Value; if (Ref.Equal(name, compiler.Atoms.Select)) { this.selectKey = compiler.AddQuery(value); } else if (Ref.Equal(name, compiler.Atoms.Mode)) { Debug.Assert(this.mode == null); if (compiler.AllowBuiltInMode && value == "*") { this.mode = Compiler.BuiltInMode; } else { this.mode = compiler.CreateXPathQName(value); } } else { return(false); } return(true); }
internal override void Compile(Compiler compiler) { Debug.Assert(Keywords.Equals(compiler.Input.LocalName, compiler.Atoms.UseAttributeSets)); this.useString = compiler.Input.Value; Debug.Assert(this.useAttributeSets == null); if (this.useString.Length == 0) { // Split creates empty node is spliting empty string this.useAttributeSets = new XmlQualifiedName[0]; return; } string[] qnames = XmlConvert.SplitString(this.useString); try { this.useAttributeSets = new XmlQualifiedName[qnames.Length]; { for (int i = 0; i < qnames.Length; i++) { this.useAttributeSets[i] = compiler.CreateXPathQName(qnames[i]); } } } catch (XsltException) { if (!compiler.ForwardCompatibility) { // Rethrow the exception if we're not in forwards-compatible mode throw; } // Ignore the whole list in forwards-compatible mode this.useAttributeSets = new XmlQualifiedName[0]; } }
private static OutputMethod ParseOutputMethod(string value, Compiler compiler) { XmlQualifiedName method = compiler.CreateXPathQName(value); if (method.Namespace.Length != 0) { return(OutputMethod.Other); } switch (method.Name) { case "xml": return(OutputMethod.Xml); case "html": return(OutputMethod.Html); case "text": return(OutputMethod.Text); default: if (compiler.ForwardCompatibility) { return(OutputMethod.Unknown); } throw XsltException.Create(Res.Xslt_InvalidAttrValue, "method", value); } }
internal override bool CompileAttribute(Compiler compiler) { string name = compiler.Input.LocalName; string value = compiler.Input.Value; if (Ref.Equal(name, compiler.Atoms.Select)) { _selectKey = compiler.AddQuery(value); } else if (Ref.Equal(name, compiler.Atoms.Mode)) { Debug.Assert(_mode == null); if (compiler.AllowBuiltInMode && value == "*") { _mode = Compiler.BuiltInMode; } else { _mode = compiler.CreateXPathQName(value); } } else { return false; } return true; }
internal override void Compile(Compiler compiler) { Debug.Assert(Ref.Equal(compiler.Input.LocalName, compiler.Atoms.UseAttributeSets)); this.useString = compiler.Input.Value; Debug.Assert(this.useAttributeSets == null); if (this.useString.Length == 0) { // Split creates empty node is spliting empty string this.useAttributeSets = new XmlQualifiedName[0]; return; } string[] qnames = XmlConvert.SplitString(this.useString); try { this.useAttributeSets = new XmlQualifiedName[qnames.Length]; { for (int i = 0; i < qnames.Length; i++) { this.useAttributeSets[i] = compiler.CreateXPathQName(qnames[i]); } } } catch (XsltException) { if (!compiler.ForwardCompatibility) { // Rethrow the exception if we're not in forwards-compatible mode throw; } // Ignore the whole list in forwards-compatible mode this.useAttributeSets = new XmlQualifiedName[0]; } }
internal override bool CompileAttribute(Compiler compiler) { string name = compiler.Input.LocalName; string value = compiler.Input.Value; if (Ref.Equal(name, compiler.Atoms.Match)) { Debug.Assert(_matchKey == Compiler.InvalidQueryKey); _matchKey = compiler.AddQuery(value, /*allowVars:*/ false, /*allowKey:*/ true, /*pattern*/ true); } else if (Ref.Equal(name, compiler.Atoms.Name)) { Debug.Assert(_name == null); _name = compiler.CreateXPathQName(value); } else if (Ref.Equal(name, compiler.Atoms.Priority)) { Debug.Assert(double.IsNaN(_priority)); _priority = XmlConvert.ToXPathDouble(value); if (double.IsNaN(_priority) && !compiler.ForwardCompatibility) { throw XsltException.Create(SR.Xslt_InvalidAttrValue, "priority", value); } } else if (Ref.Equal(name, compiler.Atoms.Mode)) { Debug.Assert(_mode == null); if (compiler.AllowBuiltInMode && value == "*") { _mode = Compiler.BuiltInMode; } else { _mode = compiler.CreateXPathQName(value); } } 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 { string nspace = input.NamespaceURI; string name = input.LocalName; string value = input.Value; if (nspace.Length != 0) { continue; } if (Ref.Equal(name, input.Atoms.Name)) { Name = compiler.CreateXPathQName(value); } else if (Ref.Equal(name, input.Atoms.Match)) { MatchKey = compiler.AddQuery(value, /*allowVars:*/ false, /*allowKey*/ false, /*pattern*/ true); } else if (Ref.Equal(name, input.Atoms.Use)) { UseKey = compiler.AddQuery(value, /*allowVars:*/ false, /*allowKey*/ false, /*pattern*/ false); } else { if (!compiler.ForwardCompatibility) { throw XsltException.Create(SR.Xslt_InvalidAttribute, name, element); } } }while (input.MoveToNextAttribute()); input.ToParent(); } CheckRequiredAttribute(compiler, MatchKey != Compiler.InvalidQueryKey, "match"); CheckRequiredAttribute(compiler, UseKey != Compiler.InvalidQueryKey, "use"); CheckRequiredAttribute(compiler, Name != null, "name"); // It is a breaking change to check for emptiness, SQLBUDT 324364 //CheckEmpty(compiler); compiler.InsertKey(Name !, MatchKey, UseKey); }
internal override bool CompileAttribute(Compiler compiler) { string name = compiler.Input.LocalName; string value = compiler.Input.Value; if (Ref.Equal(name, compiler.Atoms.Name)) { Debug.Assert(this.name == null); this.name = compiler.CreateXPathQName(value); } 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 { 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.AddQuery(value, /*allowVars:*/ false, /*allowKey*/ false, /*pattern*/ true); } else if (Keywords.Equals(name, input.Atoms.Use)) { UseKey = compiler.AddQuery(value, /*allowVars:*/ false, /*allowKey*/ false, /*pattern*/ false); } else { if (!compiler.ForwardCompatibility) { throw XsltException.Create(Res.Xslt_InvalidAttribute, name, element); } } }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.name = compiler.CreateXPathQName(value); } else { return(false); } return(true); }
internal override bool CompileAttribute(Compiler compiler) { string name = compiler.Input.LocalName; string value = compiler.Input.Value; if (Ref.Equal(name, compiler.Atoms.Name)) { Debug.Assert(this.name == null); this.name = compiler.CreateXPathQName(value); } else if (Ref.Equal(name, compiler.Atoms.UseAttributeSets)) { // create a UseAttributeSetsAction // sets come before xsl:attributes AddAction(compiler.CreateUseAttributeSetsAction()); } else { return false; } return true; }
internal override bool CompileAttribute(Compiler compiler) { string name = compiler.Input.LocalName; string value = compiler.Input.Value; if (Ref.Equal(name, compiler.Atoms.Select)) { _selectKey = compiler.AddQuery(value); } else if (Ref.Equal(name, compiler.Atoms.Mode)) { Debug.Assert(_mode == null); _mode = compiler.CreateXPathQName(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.name = compiler.CreateXPathQName(value); } else if (Keywords.Equals(name, compiler.Atoms.UseAttributeSets)) { // create a UseAttributeSetsAction // sets come before xsl:attributes AddAction(compiler.CreateUseAttributeSetsAction()); } 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 { string nspace = input.NamespaceURI; string name = input.LocalName; string value = input.Value; if (nspace.Length != 0) continue; if (Ref.Equal(name, input.Atoms.Name)) { Name = compiler.CreateXPathQName(value); } else if (Ref.Equal(name, input.Atoms.Match)) { MatchKey = compiler.AddQuery(value, /*allowVars:*/false, /*allowKey*/false, /*pattern*/true); } else if (Ref.Equal(name, input.Atoms.Use)) { UseKey = compiler.AddQuery(value, /*allowVars:*/false, /*allowKey*/false, /*pattern*/false); } else { if (! compiler.ForwardCompatibility) { throw XsltException.Create(Res.Xslt_InvalidAttribute, name, element); } } } while(input.MoveToNextAttribute()); input.ToParent(); } CheckRequiredAttribute(compiler, MatchKey != Compiler.InvalidQueryKey, "match"); CheckRequiredAttribute(compiler, UseKey != Compiler.InvalidQueryKey, "use" ); CheckRequiredAttribute(compiler, Name != null , "name" ); // It is a breaking change to check for emptiness, SQLBUDT 324364 //CheckEmpty(compiler); compiler.InsertKey(Name, MatchKey, UseKey); }
private static OutputMethod ParseOutputMethod(string value, Compiler compiler) { XmlQualifiedName method = compiler.CreateXPathQName(value); if(method.Namespace.Length != 0) { return OutputMethod.Other; } switch(method.Name) { case "xml" : return OutputMethod.Xml ; case "html" : return OutputMethod.Html; case "text" : return OutputMethod.Text; default : if (compiler.ForwardCompatibility) { return OutputMethod.Unknown; } throw XsltException.Create(Res.Xslt_InvalidAttrValue, "method", value); } }
internal override bool CompileAttribute(Compiler compiler) { string name = compiler.Input.LocalName; string value = compiler.Input.Value; if (Keywords.Equals(name, compiler.Atoms.Match)) { Debug.Assert(this.matchKey == Compiler.InvalidQueryKey); this.matchKey = compiler.AddQuery(value, /*allowVars:*/false, /*allowKey:*/true, /*pattern*/true); } else if (Keywords.Equals(name, compiler.Atoms.Name)) { Debug.Assert(this.name == null); this.name = compiler.CreateXPathQName(value); } else if (Keywords.Equals(name, compiler.Atoms.Priority)) { Debug.Assert(Double.IsNaN(this.priority)); this.priority = XmlConvert.ToXPathDouble(value); if (double.IsNaN(this.priority) && ! compiler.ForwardCompatibility) { throw XsltException.Create(Res.Xslt_InvalidAttrValue, Keywords.s_Priority, value); } } else if (Keywords.Equals(name, compiler.Atoms.Mode)) { Debug.Assert(this.mode == null); if (compiler.AllowBuiltInMode && value == "*") { this.mode = Compiler.BuiltInMode; } else { this.mode = compiler.CreateXPathQName(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); } else if (Keywords.Equals(name, compiler.Atoms.Select)) { this.selectKey = compiler.AddQuery(value); } else { return false; } return true; }
protected void CompileDecimalFormat(Compiler compiler) { NumberFormatInfo info = new NumberFormatInfo(); DecimalFormat format = new DecimalFormat(info, '#', '0', ';'); XmlQualifiedName?Name = null; NavigatorInput input = compiler.Input; if (input.MoveToFirstAttribute()) { do { if (input.Prefix.Length != 0) { continue; } string name = input.LocalName; string value = input.Value; if (Ref.Equal(name, input.Atoms.Name)) { Name = compiler.CreateXPathQName(value); } else if (Ref.Equal(name, input.Atoms.DecimalSeparator)) { info.NumberDecimalSeparator = value; } else if (Ref.Equal(name, input.Atoms.GroupingSeparator)) { info.NumberGroupSeparator = value; } else if (Ref.Equal(name, input.Atoms.Infinity)) { info.PositiveInfinitySymbol = value; } else if (Ref.Equal(name, input.Atoms.MinusSign)) { info.NegativeSign = value; } else if (Ref.Equal(name, input.Atoms.NaN)) { info.NaNSymbol = value; } else if (Ref.Equal(name, input.Atoms.Percent)) { info.PercentSymbol = value; } else if (Ref.Equal(name, input.Atoms.PerMille)) { info.PerMilleSymbol = value; } else if (Ref.Equal(name, input.Atoms.Digit)) { if (CheckAttribute(value.Length == 1, compiler)) { format.digit = value[0]; } } else if (Ref.Equal(name, input.Atoms.ZeroDigit)) { if (CheckAttribute(value.Length == 1, compiler)) { format.zeroDigit = value[0]; } } else if (Ref.Equal(name, input.Atoms.PatternSeparator)) { if (CheckAttribute(value.Length == 1, compiler)) { format.patternSeparator = value[0]; } } }while (input.MoveToNextAttribute()); input.ToParent(); } info.NegativeInfinitySymbol = string.Concat(info.NegativeSign, info.PositiveInfinitySymbol); if (Name == null) { Name = new XmlQualifiedName(); } compiler.AddDecimalFormat(Name, format); CheckEmpty(compiler); }
protected void CompileDecimalFormat(Compiler compiler){ NumberFormatInfo info = new NumberFormatInfo(); DecimalFormat format = new DecimalFormat(info, '#', '0', ';'); XmlQualifiedName Name = null; NavigatorInput input = compiler.Input; if (input.MoveToFirstAttribute()) { do { if (input.Prefix.Length != 0) continue; string name = input.LocalName; string value = input.Value; if (Ref.Equal(name, input.Atoms.Name)) { Name = compiler.CreateXPathQName(value); } else if (Ref.Equal(name, input.Atoms.DecimalSeparator)) { info.NumberDecimalSeparator = value; } else if (Ref.Equal(name, input.Atoms.GroupingSeparator)) { info.NumberGroupSeparator = value; } else if (Ref.Equal(name, input.Atoms.Infinity)) { info.PositiveInfinitySymbol = value; } else if (Ref.Equal(name, input.Atoms.MinusSign)) { info.NegativeSign = value; } else if (Ref.Equal(name, input.Atoms.NaN)) { info.NaNSymbol = value; } else if (Ref.Equal(name, input.Atoms.Percent)) { info.PercentSymbol = value; } else if (Ref.Equal(name, input.Atoms.PerMille)) { info.PerMilleSymbol = value; } else if (Ref.Equal(name, input.Atoms.Digit)) { if (CheckAttribute(value.Length == 1, compiler)) { format.digit = value[0]; } } else if (Ref.Equal(name, input.Atoms.ZeroDigit)) { if (CheckAttribute(value.Length == 1, compiler)) { format.zeroDigit = value[0]; } } else if (Ref.Equal(name, input.Atoms.PatternSeparator)) { if (CheckAttribute(value.Length == 1, compiler)) { format.patternSeparator = value[0]; } } } while(input.MoveToNextAttribute()); input.ToParent(); } info.NegativeInfinitySymbol = String.Concat(info.NegativeSign, info.PositiveInfinitySymbol); if (Name == null) { Name = new XmlQualifiedName(); } compiler.AddDecimalFormat(Name, format); CheckEmpty(compiler); }
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 { 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.AddQuery(value, /*allowVars:*/false, /*allowKey*/false, /*pattern*/true); } else if (Keywords.Equals(name, input.Atoms.Use)) { UseKey = compiler.AddQuery(value, /*allowVars:*/false, /*allowKey*/false, /*pattern*/false); } else { if (! compiler.ForwardCompatibility) { throw XsltException.Create(Res.Xslt_InvalidAttribute, name, element); } } } 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); }