I would like in a Beamer document to dynamically highlight a path leading from the root of a tree (defined using the forest package) to a specific node by defining a forest style. Below is a minimum non-working example.
The issue is that the style onslide is defined in TikZ which does not recognize the forest style path highlight that I defined. I also cannot define the path highlight style in TikZ instead, since TikZ does not know forest styles like edge and for ancestor.
Followup question: In the highlighted path, is it possible to leave just the root unhighlighted?
Example:
\documentclass{beamer}
\usepackage{tikz}
\tikzset{onslide/.code args={<#1>#2}{%
\only<#1>{\pgfkeysalso{#2}}
}} % use a style for a node/path only on certain slides
%https://tex.stackexchange.com/q/253364/9789
\usepackage{forest}
\begin{document}
\forestset{path highlight/.style={edge=red,line width=2pt,
for ancestors={edge=red, line width=2pt}}}
\begin{frame}{}
\begin{forest}
[VP
[DP
[V']
[DP,onslide=<2->{path highlight}]
]
[DP]
]
\end{forest}
\end{frame}
\end{document}

