Your notation is a little mixed up. Typically, we would write:
[itex]ds^2 = \sum_{u v} g_{uv} dx^u dx^v[/itex]
where [itex]ds[/itex] is the line element, sort of an infinitesimal length, and [itex]u, v[/itex] range over the indices for your coordinate system, and [itex]g_{uv}[/itex] is a component of the metric tensor in that coordinate system. There is no factor of [itex]2[/itex], and it doesn't make sense to write [itex]g_{uv} (dt^2 - dx^2)[/itex]. [itex]u[/itex] and [itex]v[/itex] are dummy indices, while [itex]t[/itex] and [itex]x[/itex] are specific coordinates. It would make sense to write:
[itex]ds^2 = g_{tt} dt^2 + g_{xx} dx^2[/itex]
using [itex]t[/itex] and [itex]x[/itex] as both the coordinates and the indices, or you can write it as:
[itex]ds^2 = g_{00} (dx^0)^2 + g_{11} (dx^1)^2[/itex]
where [itex]x^0 \equiv t[/itex] and [itex]x^1 \equiv x[/itex]
Let's not prejudice ourselves by writing [itex]x[/itex] and [itex]t[/itex], but instead start with arbitrary coordinates [itex]u[/itex] and [itex]v[/itex]. Then we can write it as a matrix problem:
[itex]ds^2 = \left( \begin{array} \\ du & dv \end{array} \right) \left( \begin{array} \\ g_{uu} & g_{uv} \\ g_{vu} & g_{vv} \end{array} \right) \left( \begin{array} \\ du \\ dv \end{array} \right) = g_{uu} du^2 + g_{uv} du dv + g_{vu} dv du + g_{vv} dv^2[/itex]
Then the issue is to change coordinates from [itex]u, v[/itex] to [itex]x, t[/itex] via a transformation matrix [itex]K[/itex]:
[itex]\left( \begin{array} \\ du \\ dv \end{array} \right) = \left( \begin{array} \\ K_{ut} & K_{ux} \\ K_{vt} & K_{vx} \end{array} \right) \left( \begin{array} \\ dt \\ dx \end{array} \right)[/itex]
Then you want to choose [itex]K[/itex] such that [itex]\tilde{g} \equiv K^T g K[/itex] is diagonal (as a matrix equation), where [itex]K^T[/itex] means the transpose of [itex]K[/itex]. Then in terms of [itex]\tilde{g}[/itex], you have:
[itex]ds^2 = \left( \begin{array} \\ dt & dx \end{array} \right) \left( \begin{array} \\ \tilde{g}_{tt} & 0 \\ 0 & \tilde{g}_{xx} \end{array} \right) \left( \begin{array} \\ dt \\ dx \end{array} \right) = \tilde{g}_{tt} dt^2 + \tilde{g}_{xx} dx^2[/itex]
Once the metric is diagonal, you can get it into the form: [itex]ds^2 = g_{tt} (dt^2 - dx^2)[/itex] by just scaling [itex]x[/itex]: [itex]x \rightarrow \frac{\sqrt{g_{tt}}}{\sqrt{-g_{xx}}} x[/itex]
Note, that all of this is taking place at a single point. That is, you can always pick coordinates so that [itex]g_{xt} = 0[/itex] at a single point. I'm actually not sure if it's always possible to make the metric diagonal at every point.