public XslTemplate(Compiler c) { if (c == null) { return; // built in template } this.style = c.CurrentStylesheet; c.PushScope(); if (c.Input.Name == "template" && c.Input.NamespaceURI == Compiler.XsltNamespace && c.Input.MoveToAttribute("mode", String.Empty)) { c.Input.MoveToParent(); if (!c.Input.MoveToAttribute("match", String.Empty)) { throw new XsltCompileException("XSLT 'template' element must not have 'mode' attribute when it does not have 'match' attribute", null, c.Input); } c.Input.MoveToParent(); } if (c.Input.NamespaceURI != Compiler.XsltNamespace) { this.name = QName.Empty; this.match = c.CompilePattern("/", c.Input); this.mode = QName.Empty; } else { this.name = c.ParseQNameAttribute("name"); this.match = c.CompilePattern(c.GetAttribute("match"), c.Input); this.mode = c.ParseQNameAttribute("mode"); string pri = c.GetAttribute("priority"); if (pri != null) { try { this.priority = double.Parse(pri, CultureInfo.InvariantCulture); } catch (FormatException ex) { throw new XsltException("Invalid priority number format", ex, c.Input); } } } Parse(c); stackSize = c.PopScope().VariableHighTide; }
public XslTemplate(Compiler c) { if (c == null) { return; } this.style = c.CurrentStylesheet; c.PushScope(); if (c.Input.Name == "template" && c.Input.NamespaceURI == "http://www.w3.org/1999/XSL/Transform" && c.Input.MoveToAttribute("mode", string.Empty)) { c.Input.MoveToParent(); if (!c.Input.MoveToAttribute("match", string.Empty)) { throw new XsltCompileException("XSLT 'template' element must not have 'mode' attribute when it does not have 'match' attribute", null, c.Input); } c.Input.MoveToParent(); } if (c.Input.NamespaceURI != "http://www.w3.org/1999/XSL/Transform") { this.name = XmlQualifiedName.Empty; this.match = c.CompilePattern("/", c.Input); this.mode = XmlQualifiedName.Empty; } else { this.name = c.ParseQNameAttribute("name"); this.match = c.CompilePattern(c.GetAttribute("match"), c.Input); this.mode = c.ParseQNameAttribute("mode"); string attribute = c.GetAttribute("priority"); if (attribute != null) { try { this.priority = double.Parse(attribute, CultureInfo.InvariantCulture); } catch (FormatException innerException) { throw new XsltException("Invalid priority number format", innerException, c.Input); } } } this.Parse(c); this.stackSize = c.PopScope().VariableHighTide; }
public XslTemplate (Compiler c) { if (c == null) return; // built in template this.style = c.CurrentStylesheet; c.PushScope (); if (c.Input.Name == "template" && c.Input.NamespaceURI == Compiler.XsltNamespace && c.Input.MoveToAttribute ("mode", String.Empty)) { c.Input.MoveToParent (); if (!c.Input.MoveToAttribute ("match", String.Empty)) throw new XsltCompileException ("XSLT 'template' element must not have 'mode' attribute when it does not have 'match' attribute", null, c.Input); c.Input.MoveToParent (); } if (c.Input.NamespaceURI != Compiler.XsltNamespace) { this.name = QName.Empty; this.match = c.CompilePattern ("/", c.Input); this.mode = QName.Empty; } else { this.name = c.ParseQNameAttribute ("name"); this.match = c.CompilePattern (c.GetAttribute ("match"), c.Input); this.mode = c.ParseQNameAttribute ("mode"); string pri = c.GetAttribute ("priority"); if (pri != null) { try { this.priority = double.Parse (pri, CultureInfo.InvariantCulture); } catch (FormatException ex) { throw new XsltException ("Invalid priority number format", ex, c.Input); } } } Parse (c); stackSize = c.PopScope ().VariableHighTide; }