Something like this:

nullifyAttrSplice = do
    node <- getParamNode
    let ma = getAttribute "attr" node
        cs = childNodes node
    maybe (return cs)
          (\a -> return . map (nullifyAttr a) =<< runNodeList cs) ma

deleteAttribute :: Text -> Node -> Node
deleteAttribute t n = n { elementAttrs = remove (elementAttrs n) }
  where
    remove = filter ((/=t) . fst)

nullifyAttr attr e@(Element t as cs) = maybe e f $ lookup attr as
  where f a = if T.null a
                  then deleteAttribute attr e
                  else setAttribute attr "" e
nullifyAttr _ n = n

Surround any tag with the nullify tag and it will convert the desired
attribute into either present or not.

On Fri, Apr 8, 2011 at 5:08 PM, Gregory Collins <[email protected]> wrote:
> On Fri, Apr 8, 2011 at 8:58 PM, MightyByte <[email protected]> wrote:
>> Anyone else have thoughts on this issue?
>
> Write a splice for input which checks for something like "isChecked"
> and sets "checked" accordingly?
>
> G
> --
> Gregory Collins <[email protected]>
>
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap

Reply via email to