Let $E$ be normed space and $I: E \to \mathbb{R}$ be an operator given by $$I(u) = \int_{\Omega} \dfrac{|\nabla u|^{p(x)}}{p(x)} \, \mathrm{d}x,$$ where $p \in C^{0,1}(\overline{\Omega})$. Knowing that its Fréchet derivative $I'(u)$ in $u \in E$ is a linear and continuous application such that $$\lim_{||v|| \to 0} \dfrac{|I(u + v) - I(u) - I'(u) \cdot v|}{||v||} = 0,$$ it is possible to conclude that $$I'(u) \cdot v = \int_{\Omega} |\nabla u|^{p(x) - 2} \nabla u \nabla v \, \mathrm{d}x?$$
Note: In the case where $p(x) \equiv p$, it is natural that its derivative is given by the previous expression.