Formula for a Line Integral in Curvilinear Coordinates.

I am familiar with the formula for a path integral given a parametrisation $$\textbf{x}(t)$$, $$t \in l \subseteq \mathbb{R}$$ of a curve $$C$$, and given some scalar function $$f(x,y,z)$$, $$\int_C f ds = \int_l f(\textbf{x}(t)) \Big | \Big |\frac{d \textbf{x}}{d t} \Big | \Big| dt$$

Now, my lecture notes say if we are in some curvilinear coordinates $$(\xi_1, \xi_2, \xi_3)$$, we describe the curve in curvilinear coordinates by $$\boldsymbol{\xi}(u), u \in l' \subseteq \mathbb{R}$$, we have some transformation $$\boldsymbol{\phi}$$ such that the curve $$C$$ is parametrised by $$\boldsymbol{\phi}(\boldsymbol{\xi}(u))$$, and we have some scalar function $$g$$ = $$g(\boldsymbol{\xi})$$, $$\int_C g(\boldsymbol{\xi}) ds = \int_{l'} g(\boldsymbol{\xi}) \Big | \Big |\frac{d \boldsymbol{\phi}(\boldsymbol{\xi})(u)}{d u} \Big | \Big| du$$

My understanding is that usually when we have a scalar function $$f(x,y,z)$$, for every point in 3D space, there is a (unique) corresponding scalar value. But in the curvilinear case, when we consider scalar functions, do we consider functions that directly create a correspondence between points in parameter space $$(\xi_1, \xi_2, \xi_3)$$ to scalar values? Or do we first convert these points into cartesian coordinates? Why is the formula not $$\int_C g(\boldsymbol{\phi}(\boldsymbol{\xi})) ds = \int_{l'} g(\boldsymbol{\phi}(\boldsymbol{\xi})) \Big | \Big |\frac{d \boldsymbol{\phi}(\boldsymbol{\xi})(u)}{d u} \Big | \Big| du$$

Which seems to be equivalent to the first formula. When we integrate a scalar field over some curve, don't we want the scalar field to be evaluated over that curve?