//! OOXML markup-compatibility (`mc:AlternateContent`) branch selection.
usecrate::package::xml::{Element, ns};/// Pick the branch of an `mc:AlternateContent` to process: the first
/// `mc:Choice` whose `Requires` namespaces are all supported, else the
/// `mc:Fallback`.
pubfnalternate_branch<'e>(alt:&'e Element, supported:&[&str])->Option<&'e Element>{
alt.find_all(ns::MC,"Choice").find(|c|choice_supported(c, supported)).or_else(||alt.find(ns::MC,"Fallback"))}fnchoice_supported(choice:&Element, supported:&[&str])->bool{letSome(requires)= choice.attr(ns::MC,"Requires")else{returntrue;};// Requires prefixes were resolved to namespace URIs at parse time, in
// the element's own lexical scope; an unresolved prefix stays literal
// and matches nothing.
requires.split_whitespace().all(|uri|supported.contains(&uri))}