Rust macro does not accept variable

Hello, I'm trying to use variable in a macro to reduce duplicate in my code but I can't figure out how to do that. Here's the code I have :

fn extract_element(page: &Html, tag: &str, attribute: &str) -> Vec<String> {
    page.tree
        .values()
        .filter_map(|v| match v {
            scraper::Node::Element(element) => {
                let element = element.to_owned();
                if !matches!(element.name.local, local_name!(tag)) {
                    return None;
                }
                for (key, value) in &element.attrs {
                    if matches!(key.local, local_name!(attribute)) {
                        return Some(value.to_string());
                    }
                }
                None
            }
            _ => None,
        })
        .collect()
}

The problem occurs in local_name!() from markup5ever. My compiler says no rules expected this token in macro call. However if I try to use directly a hardcoded it works without a problem. I tried to use String and stringify!() and even define a macro that does the same thing as the function to recreate functions with hardcoded string at compile time but I have the exact same error. I did not found any document about that and the rustc explain doens't actually talk about that issue

Does anyone know how to resolve this ?

The macro only works with literals.

You could perhaps build a HashMap with the entries you care about, or a function with a big match.