public bool AddVarPar(VarPar var) { Debug.Assert(var.NodeType == XslNodeType.Variable || var.NodeType == XslNodeType.Param); Debug.Assert(var.Name.NamespaceUri != null, "Name must be resolved in XsltLoader"); foreach (XslNode prevVar in GlobalVarPars) { if (prevVar.Name.Equals(var.Name)) { // [ERR XT0630] It is a static error if a stylesheet contains more than one binding // of a global variable with the same name and same import precedence, unless it also // contains another binding with the same name and higher import precedence. return compiler.AllGlobalVarPars.ContainsKey(var.Name); } } GlobalVarPars.Add(var); return true; }
protected virtual T VisitWithParam(VarPar node) { return(VisitChildren(node)); }
protected virtual T VisitVariable(VarPar node) { return(VisitChildren(node)); }
private XmlQueryType ChooseBestType(VarPar var) { if (IsDebug || !InferXPathTypes) { return T.ItemS; } switch (var.Flags & XslFlags.TypeFilter) { case XslFlags.String: return T.StringX; ; case XslFlags.Number: return T.DoubleX; case XslFlags.Boolean: return T.BooleanX; case XslFlags.Node: return T.NodeNotRtf; case XslFlags.Nodeset: return T.NodeNotRtfS; case XslFlags.Rtf: return T.Node; case XslFlags.Node | XslFlags.Rtf: return T.Node; case XslFlags.Node | XslFlags.Nodeset: return T.NodeNotRtfS; case XslFlags.Nodeset | XslFlags.Rtf: return T.NodeS; case XslFlags.Node | XslFlags.Nodeset | XslFlags.Rtf: return T.NodeS; default: return T.ItemS; } }
private QilIterator CompileGlobalVarPar(VarPar varPar) { Debug.Assert(varPar.NodeType == XslNodeType.Variable || varPar.NodeType == XslNodeType.Param); QilIterator it = (QilIterator)varPar.Value; QilList nsList = EnterScope(varPar); QilNode content = CompileVarParValue(varPar); SetLineInfo(content, it.SourceLine); content = AddCurrentPositionLast(content); content = SetDebugNs(content, nsList); it.SourceLine = SourceLineInfo.NoSource; it.Binding = content; ExitScope(); return it; }
private void CreateGlobalVarPar(VarPar varPar) { Debug.Assert(varPar.NodeType == XslNodeType.Variable || varPar.NodeType == XslNodeType.Param); XmlQueryType xt = ChooseBestType(varPar); QilIterator it; if (varPar.NodeType == XslNodeType.Variable) { it = _f.Let(_f.Unknown(xt)); } else { it = _f.Parameter(null, varPar.Name, xt); } it.DebugName = varPar.Name.ToString(); varPar.Value = it; SetLineInfo(it, varPar.SourceLine); _scope.AddVariable(varPar.Name, it); }
private void CompileWithParam(VarPar withParam) { Debug.Assert(withParam.NodeType == XslNodeType.WithParam); QilList nsList = EnterScope(withParam); QilNode paramValue = CompileVarParValue(withParam); ExitScope(); SetLineInfo(paramValue, withParam.SourceLine); paramValue = SetDebugNs(paramValue, nsList); withParam.Value = paramValue; }