internal static void AddSingleAttributeFragments(IDocumentProcessor docProcessor, string attrName, string attrValue, bool isRoot, ITemplate template, IRenderFunction fragments, GenericElementProcessorContext context)
        {
            string actualName;

            if (attrName == "actualName")
            {
                // This will translate into "name", but not with our ID prefixed. We need this because for top-level templates we want the names undisturbed to allow for a nice form submission.
                // However, for nested forms which we won't submit using the normal techniques, we need to prefix it in order to make radio buttons work reliably.
                actualName = "name";
            }
            else
            {
                actualName = attrName;
            }

            fragments.AddFragment(new LiteralFragment(" " + actualName + "=\""));
            if (attrName == "id")
            {
                if (isRoot)
                {
                    throw ParserUtils.TemplateErrorException("Can't specify an ID for the top level element.");
                }
                if (template.HasMember(attrValue))
                {
                    throw ParserUtils.TemplateErrorException("Duplicate member " + attrValue);
                }
                context.Id = attrValue;

                fragments.AddFragment(new IdFragment());
                fragments.AddFragment(new LiteralFragment("_" + attrValue));
            }
            else if (attrName.ToLowerCase() == "for" || attrName.ToLowerCase() == "name")
            {
                fragments.AddFragment(new IdFragment());
                fragments.AddFragment(new LiteralFragment("_" + attrValue));
            }
            else
            {
                IFragment f = docProcessor.ParseUntypedMarkup(attrValue);
                fragments.AddFragment(f);
                if (attrName.ToLowerCase() == "type")
                {
                    if (f is LiteralFragment)
                    {
                        context.Type = ((LiteralFragment)f).Text;
                    }
                }
                else if (isRoot && attrName.ToLowerCase() == "style")
                {
                    if (!(f is LiteralFragment) || !((LiteralFragment)f).Text.Trim().EndsWith(";"))
                    {
                        fragments.AddFragment(new LiteralFragment(";"));
                    }
                    fragments.AddFragment(new PositionFragment());
                }
            }

            fragments.AddFragment(new LiteralFragment("\""));
        }
		internal static void AddSingleAttributeFragments(IDocumentProcessor docProcessor, string attrName, string attrValue, bool isRoot, ITemplate template, IRenderFunction fragments, GenericElementProcessorContext context) {
			string actualName;
			if (attrName == "actualName") {
				// This will translate into "name", but not with our ID prefixed. We need this because for top-level templates we want the names undisturbed to allow for a nice form submission.
				// However, for nested forms which we won't submit using the normal techniques, we need to prefix it in order to make radio buttons work reliably.
				actualName = "name";
			}
			else
				actualName = attrName;
			
			fragments.AddFragment(new LiteralFragment(" " + actualName + "=\""));
			if (attrName == "id") {
				if (isRoot)
					throw ParserUtils.TemplateErrorException("Can't specify an ID for the top level element.");
				if (template.HasMember(attrValue))
					throw ParserUtils.TemplateErrorException("Duplicate member " + attrValue);
				context.Id = attrValue;

				fragments.AddFragment(new IdFragment());
				fragments.AddFragment(new LiteralFragment("_" + attrValue));
			}
			else if (attrName.ToLowerCase() == "for" || attrName.ToLowerCase() == "name") {
				fragments.AddFragment(new IdFragment());
				fragments.AddFragment(new LiteralFragment("_" + attrValue));
			}
			else {
				IFragment f = docProcessor.ParseUntypedMarkup(attrValue);
				fragments.AddFragment(f);
				if (attrName.ToLowerCase() == "type") {
					if (f is LiteralFragment)
						context.Type = ((LiteralFragment)f).Text;
				}
				else if (isRoot && attrName.ToLowerCase() == "style") {
					if (!(f is LiteralFragment) || !((LiteralFragment)f).Text.Trim().EndsWith(";"))
						fragments.AddFragment(new LiteralFragment(";"));
					fragments.AddFragment(new PositionFragment());
				}
			}

			fragments.AddFragment(new LiteralFragment("\""));
		}