fdo#39440 sax, sc: reduce scope of local variables

This addresses some cppcheck warnings.

Change-Id: I589e13ee086cffee481954215a97960db656e633
Reviewed-on: https://gerrit.libreoffice.org/13548
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>