SweetXml.transform_by

You're seeing just the function transform_by, go back to SweetXml module for more information.
Link to this function

transform_by(sweet_xpath, fun)

View Source

Tags %SweetXpath{} with fun to be applied at the end of xpath query.

Examples

iex> import SweetXml
iex> string_to_range = fn str ->
...>     [first, last] = str |> String.split("-", trim: true) |> Enum.map(&String.to_integer/1)
...>     first..last
...>   end
iex> doc = "<weather><zone><name>north</name><wind-speed>5-15</wind-speed></zone></weather>"
iex> doc
...> |> xpath(
...>      ~x"//weather/zone"l,
...>      name: ~x"//name/text()"s |> transform_by(&String.capitalize/1),
...>      wind_speed: ~x"./wind-speed/text()"s |> transform_by(string_to_range)
...>    )
[%{name: "North", wind_speed: 5..15}]