private QilName ParseModeListAttribute(int attNum)
{
//Debug.Assert(input.IsXsltKeyword(atoms.Template) && !V1);
if (!_input.MoveToXsltAttribute(attNum, "mode"))
{
return nullMode;
}
string modeList = _input.Value;
if (modeList == "#all")
{
ReportNYI("xsl:template[@mode='#all']");
return nullMode;
}
else
{
string[] list = XmlConvert.SplitString(modeList);
List<QilName> modes = new List<QilName>(list.Length);
_compiler.EnterForwardsCompatible(); // mode is always optional attribute
if (list.Length == 0)
{
ReportError(SR.Xslt_ModeListEmpty);
}
else
{
foreach (string qname in list)
{
QilName mode;
if (qname == "#default")
{
mode = nullMode;
}
else if (qname == "#current")
{
ReportNYI("xsl:apply-templates[@mode='#current']");
break;
}
else if (qname == "#all")
{
ReportError(SR.Xslt_ModeListAll);
break;
}
else
{
mode = CreateXPathQName(qname);
}
bool dup = false;
foreach (QilName m in modes)
{
dup |= m.Equals(mode);
}
if (dup)
{
ReportError(SR.Xslt_ModeListDup, qname);
}
else
{
modes.Add(mode);
}
}
}
if (!_compiler.ExitForwardsCompatible(_input.ForwardCompatibility))
{
modes.Clear();
modes.Add(nullMode);
}
if (1 < modes.Count)
{
ReportNYI("Multipe modes");
return nullMode;
}
if (modes.Count == 0)
{
return nullMode;
}
return modes[0];
}
}