public XslVariableInformation(Compiler c) { c.CheckExtraAttributes(c.Input.LocalName, "name", "select"); c.AssertAttribute("name"); name = c.ParseQNameAttribute("name"); try { XmlConvert.VerifyName(name.Name); } catch (XmlException ex) { throw new XsltCompileException("Variable name is not qualified name", ex, c.Input); } string sel = c.GetAttribute("select"); if (sel != null && sel != "") { select = c.CompileExpression(c.GetAttribute("select")); // TODO assert empty } else if (c.Input.MoveToFirstChild()) { content = c.CompileTemplateContent(); c.Input.MoveToParent(); } }
public XslVariableInformation(Compiler c) { c.CheckExtraAttributes(c.Input.LocalName, new string[] { "name", "select" }); c.AssertAttribute("name"); this.name = c.ParseQNameAttribute("name"); try { XmlConvert.VerifyName(this.name.Name); } catch (XmlException innerException) { throw new XsltCompileException("Variable name is not qualified name", innerException, c.Input); } string attribute = c.GetAttribute("select"); if (attribute != null && attribute != string.Empty) { this.select = c.CompileExpression(c.GetAttribute("select")); } else if (c.Input.MoveToFirstChild()) { this.content = c.CompileTemplateContent(); c.Input.MoveToParent(); } }
protected override void Compile(Compiler c) { if (c.Debugger != null) { c.Debugger.DebugCompile(c.Input); } c.CheckExtraAttributes("for-each", new string[] { "select" }); c.AssertAttribute("select"); this.select = c.CompileExpression(c.GetAttribute("select")); ArrayList arrayList = null; if (c.Input.MoveToFirstChild()) { bool flag = true; while (c.Input.NodeType != XPathNodeType.Text) { if (c.Input.NodeType == XPathNodeType.Element) { if (c.Input.NamespaceURI != "http://www.w3.org/1999/XSL/Transform") { flag = false; goto IL_104; } if (c.Input.LocalName != "sort") { flag = false; goto IL_104; } if (arrayList == null) { arrayList = new ArrayList(); } arrayList.Add(new Sort(c)); } if (c.Input.MoveToNext()) { continue; } IL_104: if (!flag) { this.children = c.CompileTemplateContent(); } c.Input.MoveToParent(); goto IL_122; } flag = false; goto IL_104; } IL_122: if (arrayList != null) { this.sortEvaluator = new XslSortEvaluator(this.select, (Sort[])arrayList.ToArray(typeof(Sort))); } }
protected override void Compile(Compiler c) { if (c.Debugger != null) { c.Debugger.DebugCompile(c.Input); } c.CheckExtraAttributes("for-each", "select"); c.AssertAttribute("select"); select = c.CompileExpression(c.GetAttribute("select")); ArrayList sorterList = null; if (c.Input.MoveToFirstChild()) { bool alldone = true; do { if (c.Input.NodeType == XPathNodeType.Text) { alldone = false; break; } if (c.Input.NodeType != XPathNodeType.Element) { continue; } if (c.Input.NamespaceURI != Compiler.XsltNamespace) { alldone = false; break; } if (c.Input.LocalName != "sort") { alldone = false; break; } //c.AddSort (select, new Sort (c)); if (sorterList == null) { sorterList = new ArrayList(); } sorterList.Add(new Sort(c)); }while (c.Input.MoveToNext()); if (!alldone) { children = c.CompileTemplateContent(); } c.Input.MoveToParent(); } if (sorterList != null) { sortEvaluator = new XslSortEvaluator(select, (Sort [])sorterList.ToArray(typeof(Sort))); } }
protected override void Compile (Compiler c) { if (c.Debugger != null) c.Debugger.DebugCompile (c.Input); c.CheckExtraAttributes ("fallback"); if (!c.Input.MoveToFirstChild ()) return; children = c.CompileTemplateContent (); c.Input.MoveToParent (); }
protected override void Compile (Compiler c) { if (c.Debugger != null) c.Debugger.DebugCompile (c.Input); c.CheckExtraAttributes ("comment"); if (c.Input.MoveToFirstChild ()) { value = c.CompileTemplateContent (XPathNodeType.Comment); c.Input.MoveToParent (); } }
protected override void Compile (Compiler c) { if (c.Debugger != null) c.Debugger.DebugCompile (this.DebugInput); c.CheckExtraAttributes ("message", "terminate"); terminate = c.ParseYesNoAttribute ("terminate", false); if (!c.Input.MoveToFirstChild ()) return; children = c.CompileTemplateContent (); c.Input.MoveToParent (); }
protected override void Compile(Compiler c) { if (c.Debugger != null) { c.Debugger.DebugCompile(c.Input); } c.CheckExtraAttributes("comment", new string[0]); if (c.Input.MoveToFirstChild()) { this.value = c.CompileTemplateContent(XPathNodeType.Comment); c.Input.MoveToParent(); } }
protected override void Compile (Compiler c) { if (c.Debugger != null) c.Debugger.DebugCompile (this.DebugInput); c.CheckExtraAttributes ("processing-instruction", "name"); name = c.ParseAvtAttribute ("name"); if (!c.Input.MoveToFirstChild ()) return; value = c.CompileTemplateContent (XPathNodeType.ProcessingInstruction); c.Input.MoveToParent (); }
protected override void Compile (Compiler c) { if (c.Debugger != null) c.Debugger.DebugCompile (c.Input); c.CheckExtraAttributes ("if", "test"); c.AssertAttribute ("test"); test = c.CompileExpression (c.GetAttribute ("test")); if (!c.Input.MoveToFirstChild ()) return; children = c.CompileTemplateContent (); c.Input.MoveToParent (); }
protected override void Compile(Compiler c) { if (c.Debugger != null) { c.Debugger.DebugCompile(this.DebugInput); } prefix = c.Input.Prefix; string alias = c.CurrentStylesheet.GetActualPrefix(prefix); if (alias != prefix) { prefix = alias; nsUri = c.Input.GetNamespace(alias); } else { nsUri = c.Input.NamespaceURI; } this.localname = c.Input.LocalName; this.useAttributeSets = c.ParseQNameListAttribute("use-attribute-sets", XsltNamespace); this.nsDecls = c.GetNamespacesToCopy(); if (nsDecls.Count == 0) { nsDecls = null; } this.isEmptyElement = c.Input.IsEmptyElement; if (c.Input.MoveToFirstAttribute()) { attrs = new ArrayList(); do { if (c.Input.NamespaceURI == XsltNamespace) { continue; //already handled } attrs.Add(new XslLiteralAttribute(c)); } while (c.Input.MoveToNextAttribute()); c.Input.MoveToParent(); } if (!c.Input.MoveToFirstChild()) { return; } children = c.CompileTemplateContent(); c.Input.MoveToParent(); }
protected override void Compile(Compiler c) { if (c.Debugger != null) { c.Debugger.DebugCompile(c.Input); } c.CheckExtraAttributes("fallback", new string[0]); if (!c.Input.MoveToFirstChild()) { return; } this.children = c.CompileTemplateContent(); c.Input.MoveToParent(); }
protected override void Compile (Compiler c) { if (c.Debugger != null) c.Debugger.DebugCompile (c.Input); this.nsDecls = c.GetNamespacesToCopy (); if (nsDecls.Count == 0) nsDecls = null; c.CheckExtraAttributes ("copy", "use-attribute-sets"); useAttributeSets = c.ParseQNameListAttribute ("use-attribute-sets"); if (!c.Input.MoveToFirstChild ()) return; children = c.CompileTemplateContent(); c.Input.MoveToParent (); }
protected override void Compile(Compiler c) { if (c.Debugger != null) { c.Debugger.DebugCompile(base.DebugInput); } this.prefix = c.Input.Prefix; string actualPrefix = c.CurrentStylesheet.GetActualPrefix(this.prefix); if (actualPrefix != this.prefix) { this.prefix = actualPrefix; this.nsUri = c.Input.GetNamespace(actualPrefix); } else { this.nsUri = c.Input.NamespaceURI; } this.localname = c.Input.LocalName; this.useAttributeSets = c.ParseQNameListAttribute("use-attribute-sets", "http://www.w3.org/1999/XSL/Transform"); this.nsDecls = c.GetNamespacesToCopy(); if (this.nsDecls.Count == 0) { this.nsDecls = null; } this.isEmptyElement = c.Input.IsEmptyElement; if (c.Input.MoveToFirstAttribute()) { this.attrs = new ArrayList(); do { if (!(c.Input.NamespaceURI == "http://www.w3.org/1999/XSL/Transform")) { this.attrs.Add(new XslLiteralElement.XslLiteralAttribute(c)); } }while (c.Input.MoveToNextAttribute()); c.Input.MoveToParent(); } if (!c.Input.MoveToFirstChild()) { return; } this.children = c.CompileTemplateContent(); c.Input.MoveToParent(); }
protected override void Compile(Compiler c) { if (c.Debugger != null) { c.Debugger.DebugCompile(base.DebugInput); } c.CheckExtraAttributes("message", new string[] { "terminate" }); this.terminate = c.ParseYesNoAttribute("terminate", false); if (!c.Input.MoveToFirstChild()) { return; } this.children = c.CompileTemplateContent(); c.Input.MoveToParent(); }
protected override void Compile(Compiler c) { if (c.Debugger != null) { c.Debugger.DebugCompile(base.DebugInput); } c.CheckExtraAttributes("processing-instruction", new string[] { "name" }); this.name = c.ParseAvtAttribute("name"); if (!c.Input.MoveToFirstChild()) { return; } this.value = c.CompileTemplateContent(XPathNodeType.ProcessingInstruction); c.Input.MoveToParent(); }
protected override void Compile(Compiler c) { if (c.Debugger != null) { c.Debugger.DebugCompile(c.Input); } c.CheckExtraAttributes("if", new string[] { "test" }); c.AssertAttribute("test"); this.test = c.CompileExpression(c.GetAttribute("test")); if (!c.Input.MoveToFirstChild()) { return; } this.children = c.CompileTemplateContent(); c.Input.MoveToParent(); }
protected override void Compile (Compiler c) { if (c.Debugger != null) c.Debugger.DebugCompile (c.Input); c.CheckExtraAttributes ("choose"); if (!c.Input.MoveToFirstChild ()) throw new XsltCompileException ("Expecting non-empty element", null, c.Input); do { if (c.Input.NodeType != XPathNodeType.Element) continue; if (c.Input.NamespaceURI != XsltNamespace) continue; if (defaultChoice != null) throw new XsltCompileException ("otherwise attribute must be last", null, c.Input); switch (c.Input.LocalName) { case "when": conditions.Add (new XslIf (c)); break; case "otherwise": c.CheckExtraAttributes ("otherwise"); if (c.Input.MoveToFirstChild ()) { defaultChoice = c.CompileTemplateContent (); c.Input.MoveToParent (); } break; default: if (c.CurrentStylesheet.Version == "1.0") throw new XsltCompileException ("XSLT choose element accepts only when and otherwise elements", null, c.Input); break; } } while (c.Input.MoveToNext ()); c.Input.MoveToParent (); if (conditions.Count == 0) throw new XsltCompileException ("Choose must have 1 or more when elements", null, c.Input); }
protected override void Compile(Compiler c) { if (c.Debugger != null) { c.Debugger.DebugCompile(c.Input); } this.nsDecls = c.GetNamespacesToCopy(); if (this.nsDecls.Count == 0) { this.nsDecls = null; } c.CheckExtraAttributes("copy", new string[] { "use-attribute-sets" }); this.useAttributeSets = c.ParseQNameListAttribute("use-attribute-sets"); if (!c.Input.MoveToFirstChild()) { return; } this.children = c.CompileTemplateContent(); c.Input.MoveToParent(); }
public XslVariableInformation (Compiler c) { c.CheckExtraAttributes (c.Input.LocalName, "name", "select"); c.AssertAttribute ("name"); name = c.ParseQNameAttribute ("name"); try { XmlConvert.VerifyName (name.Name); } catch (XmlException ex) { throw new XsltCompileException ("Variable name is not qualified name", ex, c.Input); } string sel = c.GetAttribute ("select"); if (sel != null && sel != "" ) { select = c.CompileExpression (c.GetAttribute ("select")); // TODO assert empty } else if (c.Input.MoveToFirstChild ()) { content = c.CompileTemplateContent (); c.Input.MoveToParent (); } }
protected override void Compile (Compiler c) { if (c.Debugger != null) c.Debugger.DebugCompile (c.Input); c.CheckExtraAttributes ("for-each", "select"); c.AssertAttribute ("select"); select = c.CompileExpression (c.GetAttribute ("select")); ArrayList sorterList = null; if (c.Input.MoveToFirstChild ()) { bool alldone = true; do { if (c.Input.NodeType == XPathNodeType.Text) { alldone = false; break; } if (c.Input.NodeType != XPathNodeType.Element) continue; if (c.Input.NamespaceURI != Compiler.XsltNamespace) { alldone = false; break; } if (c.Input.LocalName != "sort") { alldone = false; break; } //c.AddSort (select, new Sort (c)); if (sorterList == null) sorterList = new ArrayList (); sorterList.Add (new Sort (c)); } while (c.Input.MoveToNext ()); if (!alldone) children = c.CompileTemplateContent (); c.Input.MoveToParent (); } if (sorterList != null) sortEvaluator = new XslSortEvaluator (select, (Sort []) sorterList.ToArray (typeof (Sort))); }
protected override void Compile (Compiler c) { if (c.Debugger != null) c.Debugger.DebugCompile (c.Input); XPathNavigator nav = c.Input.Clone (); nsDecls = c.GetNamespacesToCopy (); c.CheckExtraAttributes ("attribute", "name", "namespace"); name = c.ParseAvtAttribute ("name"); if (name == null) throw new XsltCompileException ("Attribute \"name\" is required on XSLT attribute element", null, c.Input); ns = c.ParseAvtAttribute ("namespace"); calcName = XslAvt.AttemptPreCalc (ref name); calcPrefix = String.Empty; if (calcName != null) { int colonAt = calcName.IndexOf (':'); calcPrefix = colonAt < 0 ? String.Empty : calcName.Substring (0, colonAt); calcName = colonAt < 0 ? calcName : calcName.Substring (colonAt + 1, calcName.Length - colonAt - 1); try { XmlConvert.VerifyNCName (calcName); if (calcPrefix != String.Empty) XmlConvert.VerifyNCName (calcPrefix); } catch (XmlException ex) { throw new XsltCompileException ("Invalid attribute name", ex, c.Input); } } if (calcPrefix != String.Empty) { calcPrefix = c.CurrentStylesheet.GetActualPrefix (calcPrefix); if (calcPrefix == null) calcPrefix = String.Empty; } if (calcPrefix != String.Empty && ns == null) calcNs = nav.GetNamespace (calcPrefix); else if (ns != null) calcNs = XslAvt.AttemptPreCalc (ref ns); if (c.Input.MoveToFirstChild ()) { value = c.CompileTemplateContent (XPathNodeType.Attribute); c.Input.MoveToParent (); } }
protected override void Compile (Compiler c) { if (c.Debugger != null) c.Debugger.DebugCompile (this.DebugInput); prefix = c.Input.Prefix; string alias = c.CurrentStylesheet.GetActualPrefix (prefix); if (alias != prefix) { prefix = alias; nsUri = c.Input.GetNamespace (alias); } else nsUri = c.Input.NamespaceURI; this.localname = c.Input.LocalName; this.useAttributeSets = c.ParseQNameListAttribute ("use-attribute-sets", XsltNamespace); this.nsDecls = c.GetNamespacesToCopy (); if (nsDecls.Count == 0) nsDecls = null; this.isEmptyElement = c.Input.IsEmptyElement; if (c.Input.MoveToFirstAttribute ()) { attrs = new ArrayList (); do { if (c.Input.NamespaceURI == XsltNamespace) continue; //already handled attrs.Add (new XslLiteralAttribute (c)); } while (c.Input.MoveToNextAttribute()); c.Input.MoveToParent (); } if (!c.Input.MoveToFirstChild ()) return; children = c.CompileTemplateContent (); c.Input.MoveToParent (); }
protected override void Compile(Compiler c) { if (c.Debugger != null) { c.Debugger.DebugCompile(c.Input); } c.CheckExtraAttributes("element", "name", "namespace", "use-attribute-sets"); name = c.ParseAvtAttribute("name"); ns = c.ParseAvtAttribute("namespace"); nsDecls = c.GetNamespacesToCopy(); calcName = XslAvt.AttemptPreCalc(ref name); if (calcName != null) { int colonAt = calcName.IndexOf(':'); if (colonAt == 0) { throw new XsltCompileException("Invalid name attribute", null, c.Input); } calcPrefix = colonAt < 0 ? String.Empty : calcName.Substring(0, colonAt); if (colonAt > 0) { calcName = calcName.Substring(colonAt + 1); } try { XmlConvert.VerifyNCName(calcName); if (calcPrefix != String.Empty) { XmlConvert.VerifyNCName(calcPrefix); } } catch (XmlException ex) { throw new XsltCompileException("Invalid name attribute", ex, c.Input); } if (ns == null) { calcNs = c.Input.GetNamespace(calcPrefix); if (calcPrefix != String.Empty && calcNs == String.Empty) { throw new XsltCompileException("Invalid name attribute", null, c.Input); } } } else if (ns != null) { calcNs = XslAvt.AttemptPreCalc(ref ns); } useAttributeSets = c.ParseQNameListAttribute("use-attribute-sets"); isEmptyElement = c.Input.IsEmptyElement; if (c.Input.MoveToFirstChild()) { value = c.CompileTemplateContent(XPathNodeType.Element); c.Input.MoveToParent(); } }
protected override void Compile(Compiler c) { if (c.Debugger != null) { c.Debugger.DebugCompile(c.Input); } c.CheckExtraAttributes("choose", new string[0]); if (!c.Input.MoveToFirstChild()) { throw new XsltCompileException("Expecting non-empty element", null, c.Input); } for (;;) { if (c.Input.NodeType == XPathNodeType.Element) { if (!(c.Input.NamespaceURI != "http://www.w3.org/1999/XSL/Transform")) { if (this.defaultChoice != null) { break; } string localName = c.Input.LocalName; if (localName != null) { if (XslChoose.< > f__switch$map9 == null) { XslChoose.< > f__switch$map9 = new Dictionary <string, int>(2) { { "when", 0 }, { "otherwise", 1 } }; } int num; if (XslChoose.< > f__switch$map9.TryGetValue(localName, out num)) { if (num == 0) { this.conditions.Add(new XslIf(c)); goto IL_18C; } if (num == 1) { c.CheckExtraAttributes("otherwise", new string[0]); if (c.Input.MoveToFirstChild()) { this.defaultChoice = c.CompileTemplateContent(); c.Input.MoveToParent(); } goto IL_18C; } } } if (c.CurrentStylesheet.Version == "1.0") { goto Block_12; } } } IL_18C: if (!c.Input.MoveToNext()) { goto Block_13; } } throw new XsltCompileException("otherwise attribute must be last", null, c.Input); Block_12: throw new XsltCompileException("XSLT choose element accepts only when and otherwise elements", null, c.Input); Block_13: c.Input.MoveToParent(); if (this.conditions.Count == 0) { throw new XsltCompileException("Choose must have 1 or more when elements", null, c.Input); } }
protected override void Compile(Compiler c) { if (c.Debugger != null) { c.Debugger.DebugCompile(c.Input); } c.CheckExtraAttributes("choose"); if (!c.Input.MoveToFirstChild()) { throw new XsltCompileException("Expecting non-empty element", null, c.Input); } do { if (c.Input.NodeType != XPathNodeType.Element) { continue; } if (c.Input.NamespaceURI != XsltNamespace) { continue; } if (defaultChoice != null) { throw new XsltCompileException("otherwise attribute must be last", null, c.Input); } switch (c.Input.LocalName) { case "when": conditions.Add(new XslIf(c)); break; case "otherwise": c.CheckExtraAttributes("otherwise"); if (c.Input.MoveToFirstChild()) { defaultChoice = c.CompileTemplateContent(); c.Input.MoveToParent(); } break; default: if (c.CurrentStylesheet.Version == "1.0") { throw new XsltCompileException("XSLT choose element accepts only when and otherwise elements", null, c.Input); } break; } }while (c.Input.MoveToNext()); c.Input.MoveToParent(); if (conditions.Count == 0) { throw new XsltCompileException("Choose must have 1 or more when elements", null, c.Input); } }
protected override void Compile(Compiler c) { if (c.Debugger != null) { c.Debugger.DebugCompile(c.Input); } XPathNavigator nav = c.Input.Clone(); nsDecls = c.GetNamespacesToCopy(); c.CheckExtraAttributes("attribute", "name", "namespace"); name = c.ParseAvtAttribute("name"); if (name == null) { throw new XsltCompileException("Attribute \"name\" is required on XSLT attribute element", null, c.Input); } ns = c.ParseAvtAttribute("namespace"); calcName = XslAvt.AttemptPreCalc(ref name); calcPrefix = String.Empty; if (calcName != null) { int colonAt = calcName.IndexOf(':'); calcPrefix = colonAt < 0 ? String.Empty : calcName.Substring(0, colonAt); calcName = colonAt < 0 ? calcName : calcName.Substring(colonAt + 1, calcName.Length - colonAt - 1); try { XmlConvert.VerifyNCName(calcName); if (calcPrefix != String.Empty) { XmlConvert.VerifyNCName(calcPrefix); } } catch (XmlException ex) { throw new XsltCompileException("Invalid attribute name", ex, c.Input); } } if (calcPrefix != String.Empty) { calcPrefix = c.CurrentStylesheet.GetActualPrefix(calcPrefix); if (calcPrefix == null) { calcPrefix = String.Empty; } } if (calcPrefix != String.Empty && ns == null) { calcNs = nav.GetNamespace(calcPrefix); } else if (ns != null) { calcNs = XslAvt.AttemptPreCalc(ref ns); } if (c.Input.MoveToFirstChild()) { value = c.CompileTemplateContent(XPathNodeType.Attribute); c.Input.MoveToParent(); } }
protected override void Compile (Compiler c) { if (c.Debugger != null) c.Debugger.DebugCompile (c.Input); c.CheckExtraAttributes ("element", "name", "namespace", "use-attribute-sets"); name = c.ParseAvtAttribute ("name"); ns = c.ParseAvtAttribute ("namespace"); nsDecls = c.GetNamespacesToCopy (); calcName = XslAvt.AttemptPreCalc (ref name); if (calcName != null) { int colonAt = calcName.IndexOf (':'); if (colonAt == 0) throw new XsltCompileException ("Invalid name attribute", null, c.Input); calcPrefix = colonAt < 0 ? String.Empty : calcName.Substring (0, colonAt); if (colonAt > 0) calcName = calcName.Substring (colonAt + 1); try { XmlConvert.VerifyNCName (calcName); if (calcPrefix != String.Empty) XmlConvert.VerifyNCName (calcPrefix); } catch (XmlException ex) { throw new XsltCompileException ("Invalid name attribute", ex, c.Input); } if (ns == null) { calcNs = c.Input.GetNamespace (calcPrefix); if (calcPrefix != String.Empty && calcNs == String.Empty) throw new XsltCompileException ("Invalid name attribute", null, c.Input); } } else if (ns != null) calcNs = XslAvt.AttemptPreCalc (ref ns); useAttributeSets = c.ParseQNameListAttribute ("use-attribute-sets"); isEmptyElement = c.Input.IsEmptyElement; if (c.Input.MoveToFirstChild ()) { value = c.CompileTemplateContent (XPathNodeType.Element); c.Input.MoveToParent (); } }
protected override void Compile(Compiler c) { if (c.Debugger != null) { c.Debugger.DebugCompile(c.Input); } XPathNavigator xpathNavigator = c.Input.Clone(); this.nsDecls = c.GetNamespacesToCopy(); c.CheckExtraAttributes("attribute", new string[] { "name", "namespace" }); this.name = c.ParseAvtAttribute("name"); if (this.name == null) { throw new XsltCompileException("Attribute \"name\" is required on XSLT attribute element", null, c.Input); } this.ns = c.ParseAvtAttribute("namespace"); this.calcName = XslAvt.AttemptPreCalc(ref this.name); this.calcPrefix = string.Empty; if (this.calcName != null) { int num = this.calcName.IndexOf(':'); this.calcPrefix = ((num >= 0) ? this.calcName.Substring(0, num) : string.Empty); this.calcName = ((num >= 0) ? this.calcName.Substring(num + 1, this.calcName.Length - num - 1) : this.calcName); try { XmlConvert.VerifyNCName(this.calcName); if (this.calcPrefix != string.Empty) { XmlConvert.VerifyNCName(this.calcPrefix); } } catch (XmlException innerException) { throw new XsltCompileException("Invalid attribute name", innerException, c.Input); } } if (this.calcPrefix != string.Empty) { this.calcPrefix = c.CurrentStylesheet.GetActualPrefix(this.calcPrefix); if (this.calcPrefix == null) { this.calcPrefix = string.Empty; } } if (this.calcPrefix != string.Empty && this.ns == null) { this.calcNs = xpathNavigator.GetNamespace(this.calcPrefix); } else if (this.ns != null) { this.calcNs = XslAvt.AttemptPreCalc(ref this.ns); } if (c.Input.MoveToFirstChild()) { this.value = c.CompileTemplateContent(XPathNodeType.Attribute); c.Input.MoveToParent(); } }
protected override void Compile(Compiler c) { if (c.Debugger != null) { c.Debugger.DebugCompile(c.Input); } c.CheckExtraAttributes("element", new string[] { "name", "namespace", "use-attribute-sets" }); this.name = c.ParseAvtAttribute("name"); this.ns = c.ParseAvtAttribute("namespace"); this.nsDecls = c.GetNamespacesToCopy(); this.calcName = XslAvt.AttemptPreCalc(ref this.name); if (this.calcName != null) { int num = this.calcName.IndexOf(':'); if (num == 0) { throw new XsltCompileException("Invalid name attribute", null, c.Input); } this.calcPrefix = ((num >= 0) ? this.calcName.Substring(0, num) : string.Empty); if (num > 0) { this.calcName = this.calcName.Substring(num + 1); } try { XmlConvert.VerifyNCName(this.calcName); if (this.calcPrefix != string.Empty) { XmlConvert.VerifyNCName(this.calcPrefix); } } catch (XmlException innerException) { throw new XsltCompileException("Invalid name attribute", innerException, c.Input); } if (this.ns == null) { this.calcNs = c.Input.GetNamespace(this.calcPrefix); if (this.calcPrefix != string.Empty && this.calcNs == string.Empty) { throw new XsltCompileException("Invalid name attribute", null, c.Input); } } } else if (this.ns != null) { this.calcNs = XslAvt.AttemptPreCalc(ref this.ns); } this.useAttributeSets = c.ParseQNameListAttribute("use-attribute-sets"); this.isEmptyElement = c.Input.IsEmptyElement; if (c.Input.MoveToFirstChild()) { this.value = c.CompileTemplateContent(XPathNodeType.Element); c.Input.MoveToParent(); } }
private void Parse (Compiler c) { if (c.Input.NamespaceURI != Compiler.XsltNamespace) { content = c.CompileTemplateContent (); return; } if (c.Input.MoveToFirstChild ()) { bool alldone = true; XPathNavigator contentStart = c.Input.Clone (); bool shouldMove = false; do { if (shouldMove) { shouldMove = false; contentStart.MoveTo (c.Input); } if (c.Input.NodeType == XPathNodeType.Text) { alldone = false; break; } if (c.Input.NodeType != XPathNodeType.Element) continue; if (c.Input.NamespaceURI != Compiler.XsltNamespace) { alldone = false; break; } if (c.Input.LocalName != "param") { alldone = false; break; } if (this.parameters == null) this.parameters = new ArrayList (); parameters.Add (new XslLocalParam (c)); shouldMove = true; } while (c.Input.MoveToNext ()); if (!alldone) { c.Input.MoveTo (contentStart); content = c.CompileTemplateContent (); } c.Input.MoveToParent (); } }