public void DoReplace(ElementNode node, IList<Node> body)
 {
     string propertyExpression = node.GetAttributeValue("for");
     Node checkedSnippet = propertyExpression.GetCheckedSnippet();
     node.RemoveAttributesByName("checked");
     node.Attributes.Add(new AttributeNode("checked", new List<Node>(){checkedSnippet}));
 }
		private Node RemoteAndEvalUriSnippet(ElementNode elementNode)
		{
			string attribValue = elementNode.GetAttributeValue(replacementSpecification.OriginalAttributeName);
			elementNode.RemoveAttributesByName(replacementSpecification.OriginalAttributeName);
			return
				attribValue.GetCreateUriSnippet(
					IsTypeReplacement());
		}
Ejemplo n.º 3
0
		protected static void AddAttribute(ElementNode elementNode, string attributeName, Node childNode)
		{
			elementNode.RemoveAttributesByName(attributeName);
			elementNode.Attributes.Add(new AttributeNode(attributeName, new List<Node>
			                                                            	{
			                                                            		childNode
			                                                            	}));
		}
		private void RemoveReplacedAttribute(ElementNode elementNode)
		{
			elementNode.RemoveAttributesByName(replacementSpecification.NewAttributeName);
		}
        private void Transform(ElementNode node, IList<Node> body)
        {
            AttributeNode forAttribute = node.GetAttribute("for");
            AttributeNode forType = node.GetAttribute("fortype");
            AttributeNode forProperty = node.GetAttribute("forproperty");

            if(forAttribute!=null)
            {
                // put in as content property
                node.Attributes.Remove(forAttribute);
                node.RemoveAttributesByName("name");
                node.RemoveAttributesByName("value");
                var nameNode = new ExpressionNode(forAttribute.Value.GetPropertyNameSnippet());

                var valueNode = new ConditionNode("resource!=null")
                                     	{
                                     		Nodes = new List<Node>()
                                     		        	{
                                     		        		new ExpressionNode(forAttribute.Value)
                                     		        	}
                                     	};
                 SetNodeNameAndValue(node, valueNode, nameNode, body, forAttribute);
            }
            else if(forType!=null)
            {
                if(forProperty==null)
                {
                    throw new Exception("Must have both a forProperty attribute if using the forType attribute.");
                }
                node.Attributes.Remove(forType);
                node.Attributes.Remove(forProperty);
                node.RemoveAttributesByName("name");
                 SetNodeNameAndValue(node, null, new TextNode(string.Concat(forType.Value, ".", forProperty.Value)), body, forAttribute);
            }
        }
Ejemplo n.º 6
0
		public override void DoReplace(ElementNode node, IList<Node> body)
		{
			node.RemoveAttributesByName(ReplacementSpecification.OriginalAttributeName);
		}