downloadHTMLStyleSheet base stringHTML
    = do let html = parseTags stringHTML
             linkTags = map (fromAttrib "href") $ filter (tagOpen (=="link") funAttrs) html
             linkHref = Set.toList $ Set.fromList linkTags    -- elimina los repetidos
             funName  = map getUrlFileName linkHref
         mapM_ downloadprocess funName
    where funAttrs attrs = let pr1 = (=="href")
                               pr2 = [ (\(n,v) -> n == "rel"  && v == "stylesheet")
                                     , (\(n,v) -> n == "type" && v == "text/css")
                                     ]
                               href   = any (pr1 . fst) attrs
                               others = and $ map (\f -> any f attrs) pr2
                           in href && others
          downloadprocess (url,name)
                = do css <- download base url
                     tmpDir <- retrieveTempDir
                     let path = tmpDir </> name
                     writeFile path css
                     putStrLn $ "File saved at " ++ path
                     return ()
downloadHTMLStyleSheet base stringHTML
    = do let html = parseTags stringHTML
             linkTags = map (fromAttrib "href") $ filter (tagOpen (=="link") funAttrs) html
             linkHref = Set.toList $ Set.fromList linkTags    -- elimina los repetidos
             funName  = map getUrlFileName linkHref
         mapM_ downloadprocess funName
    where funAttrs attrs = let pr1 = (=="href")
                               pr2 = [ (\(n,v) -> n == "rel"  && v == "stylesheet")
                                     , (\(n,v) -> n == "type" && v == "text/css")
                                     ]
                               href   = any (pr1 . fst) attrs
                               others = and $ map (\f -> any f attrs) pr2
                           in href && others
          downloadprocess (url,name)
                = do css <- download base url
                     tmpDir <- retrieveTempDir
                     let path = tmpDir </> name
                     writeFile path css
                     putStrLn $ "File saved at " ++ path
                     return ()
downloadHTMLStyleSheet base stringHTML
    = do let html = parseTags stringHTML
             linkTags = map (fromAttrib "href") $ filter (tagOpen (=="link") funAttrs) html
             linkHref = Set.toList $ Set.fromList linkTags    -- elimina los repetidos
             funName  = map getUrlFileName linkHref
         mapM_ downloadprocess funName
    where funAttrs attrs = let pr1 = (=="href")
                               pr2 = [ (\(n,v) -> n == "rel"  && v == "stylesheet")
                                     , (\(n,v) -> n == "type" && v == "text/css")
                                     ]
                               href   = any (pr1 . fst) attrs
                               others = and $ map (\f -> any f attrs) pr2
                           in href && others
          downloadprocess (url,name)
                = do css <- download base url
                     tmpDir <- retrieveTempDir
                     let path = tmpDir </> name
                     writeFile path css
                     putStrLn $ "File saved at " ++ path
                     return ()