private QilNode CompileVarParValue(XslNode node)
{
Debug.Assert(node.NodeType == XslNodeType.Variable || node.NodeType == XslNodeType.Param || node.NodeType == XslNodeType.WithParam);
VerifyXPathQName(node.Name);
string baseUri = _lastScope.SourceLine.Uri;
IList<XslNode> content = node.Content;
string select = node.Select;
QilNode varValue;
if (select != null)
{
// In case of incorrect stylesheet, variable or parameter may have both a 'select' attribute and non-empty content
QilList list = InstructionList();
list.Add(CompileXPathExpression(select));
varValue = CompileInstructions(content, list);
}
else if (content.Count != 0)
{
_outputScope.PushScope();
// Rtf will be instantiated in an unknown namespace context, so we should not assume anything here
_outputScope.InvalidateAllPrefixes();
varValue = _f.RtfCtor(CompileInstructions(content), _f.String(baseUri));
_outputScope.PopScope();
}
else
{
varValue = _f.String(string.Empty);
}
if (IsDebug)
{
// In debug mode every variable/param must be of type 'any'
varValue = _f.TypeAssert(varValue, T.ItemS);
}
Debug.Assert(varValue.SourceLine == null);
return varValue;
}