Completely lost my original work, or at least the part that involved me working out the answer, but it was only a couple of months ago so managed to work through it again fairly quick! it was mainly brute force and only the minimum amount of mathematical knowledge of what i was doing...
it will do me good to write this down!
1. the XML format stores the matrix as a row of 16 numbers, so put a 'line break' after each 4th number to get a 4x4 matrix.
<transform>9.9979525172066075e-001 1.9951612434278700e-002 -3.3745811729752944e-003 9.2404807307462611e-001 -1.9937006769072906e-002 9.9979195775360141e-001 4.3077804390216183e-003 -3.2245823692836267e-001 3.4598262832987404e-003 -4.2396193807005631e-003 9.9998502750271023e-001 -1.0787526281678460e-002 0.0000000000000000e+000 0.0000000000000000e+000 0.0000000000000000e+000 1.0000000000000000e+000</transform>
becomes
9.9979525172066075e-001 1.9951612434278700e-002 -3.3745811729752944e-003 9.2404807307462611e-001
-1.9937006769072906e-002 9.9979195775360141e-001 4.3077804390216183e-003 -3.2245823692836267e-001
3.4598262832987404e-003 -4.2396193807005631e-003 9.9998502750271023e-001 -1.0787526281678460e-002
0.0000000000000000e+000 0.0000000000000000e+000 0.0000000000000000e+000 1.0000000000000000e+000
2. the OUT format stores the matrix as 4 rows of 3 numbers (after a row that encodes lens parameters). Transpose the 4th row to make the 4th column, and then create a 4th row of your own using 0.000 0.000 0.000 1.000 so you now have a 4x4 matrix too.
9.9979525172e-001 -1.9937006769e-002 3.4598262833e-003
-1.9951612434e-002 -9.9979195775e-001 4.2396193807e-003
3.3745811730e-003 -4.3077804390e-003 -9.9998502750e-001
-9.3025040491e-001 -3.0390916796e-001 -1.5294719281e-002
becomes
9.9979525172e-001 -1.9937006769e-002 3.4598262833e-003 -9.3025040491e-001
-1.9951612434e-002 -9.9979195775e-001 4.2396193807e-003 -3.0390916796e-001
3.3745811730e-003 -4.3077804390e-003 -9.9998502750e-001 -1.5294719281e-002
0.000 0.000 0.000 1.000
3. Now to convert from the XML form to the OUT form, you invert the 4x4 matrix from the XML file. I used the excel function MINVERSE because i love excel and because i'm still very much prototyping all this, which gives you:
9.9979525172E-01 -1.9937006769E-02 3.4598262833E-03 -9.3025040491E-01
1.9951612434E-02 9.9979195775E-01 -4.2396193807E-03 3.0390916796E-01
-3.3745811730E-03 4.3077804390E-03 9.9998502750E-01 1.5294719281E-02
0.0000000000E+00 0.0000000000E+00 0.0000000000E+00 1.0000000000E+00
Which is identical to the OUT matrix, except that the 2nd and 3rd rows are negated.
I think that it is the bundler format that requires these rows to be negated, and seems to be something to do with what they refer to in their documentation as perspective division. I am using these matrices to perform triangulation using opencv and am using the matrix out of the bundler out file, but negating the 2nd and 3rd rows to get what i would have got if i'd inverted the photoscan xml matrix. I read in one of the forum posts here from long long ago that photoscan inverts the matrix so that was how i tracked it down.
Hope this helps!