protected override void Compile (Compiler c) { if (c.Debugger != null) c.Debugger.DebugCompile (c.Input); c.CheckExtraAttributes ("apply-templates", "select", "mode"); select = c.CompileExpression (c.GetAttribute ("select")); mode = c.ParseQNameAttribute ("mode"); ArrayList sorterList = null; if (c.Input.MoveToFirstChild ()) { do { switch (c.Input.NodeType) { case XPathNodeType.Comment: case XPathNodeType.ProcessingInstruction: case XPathNodeType.Whitespace: case XPathNodeType.SignificantWhitespace: continue; case XPathNodeType.Element: if (c.Input.NamespaceURI != XsltNamespace) throw new XsltCompileException ("Unexpected element", null, c.Input); // TODO: fwd compat switch (c.Input.LocalName) { case "with-param": if (withParams == null) withParams = new ArrayList (); withParams.Add (new XslVariableInformation (c)); break; case "sort": if (sorterList == null) sorterList = new ArrayList (); if (select == null) select = c.CompileExpression ("*"); sorterList.Add (new Sort (c)); //c.AddSort (select, new Sort (c)); break; default: throw new XsltCompileException ("Unexpected element", null, c.Input); // todo forwards compat } break; default: throw new XsltCompileException ("Unexpected node type " + c.Input.NodeType, null, c.Input); // todo forwards compat } } while (c.Input.MoveToNext ()); 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 ("call-template", "name"); c.AssertAttribute ("name"); name = c.ParseQNameAttribute ("name"); if (c.Input.MoveToFirstChild ()) { do { switch (c.Input.NodeType) { case XPathNodeType.Comment: case XPathNodeType.ProcessingInstruction: case XPathNodeType.SignificantWhitespace: case XPathNodeType.Whitespace: continue; case XPathNodeType.Element: if (c.Input.NamespaceURI != XsltNamespace) throw new XsltCompileException ("Unexpected element", null, c.Input); // TODO: fwd compat switch (c.Input.LocalName) { case "with-param": if (withParams == null) withParams = new ArrayList (); withParams.Add (new XslVariableInformation (c)); break; default: throw new XsltCompileException ("Unexpected element", null, c.Input); // todo forwards compat } break; default: throw new XsltCompileException ("Unexpected node type " + c.Input.NodeType, null, c.Input); // TODO: fwd compat } } while (c.Input.MoveToNext ()); 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 (); } }