An example problem in the textbook I'm reading from has the spherical wrist system and the DH parameter table as shown below:
giving us the transformation matrices as below
$$ A_4=\left(\begin{array}{cccc} c_{4} & 0 & -s_{4} & 0\\ s_{4} & 0 & c_{4} & 0\\ 0 & -1 & 0 & 0\\ 0 & 0 & 0 & 1 \end{array}\right) $$ $$ A_5=\left(\begin{array}{cccc} c_{5} & 0 & s_{5} & 0\\ s_{5} & 0 & -c_{5} & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 0 & 1 \end{array}\right) $$ $$ A_6=\left(\begin{array}{cccc} c_{6} & -s_{6} & 0 & 0\\ s_{6} & c_{6} & 0 & 0\\ 0 & 0 & 1 & d_{6}\\ 0 & 0 & 0 & 1 \end{array}\right) $$ giving us the final transformation matrix as $$ T_6^3=A_4A_5A_6=\left(\begin{array}{cccc} c_{4}\,c_{5}\,c_{6}-s_{4}\,s_{6} & -c_{6}\,s_{4}-c_{4}\,c_{5}\,s_{6} & c_{4}\,s_{5} & c_{4}\,d_{6}\,s_{5}\\ c_{4}\,s_{6}+c_{5}\,c_{6}\,s_{4} & c_{4}\,c_{6}-c_{5}\,s_{4}\,s_{6} & s_{4}\,s_{5} & d_{6}\,s_{4}\,s_{5}\\ -c_{6}\,s_{5} & s_{5}\,s_{6} & c_{5} & c_{5}\,d_{6}\\ 0 & 0 & 0 & 1 \end{array}\right) $$ per the textbook.
I think $A_5$ given in the text is wrong. Shouldn't the $\theta$ parameter against link 5 be $\theta_5-90^\circ$? That would give us $$ A_5=\left(\begin{array}{cccc} s_{5} & 0 & -c_{5} & 0\\ -c_{5} & 0 & -s_{5} & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 0 & 1 \end{array}\right) $$ and the final transformation matrix as $$ T_6^3=\left(\begin{array}{cccc} c_{4}\,c_{6}\,s_{5}-s_{4}\,s_{6} & -c_{6}\,s_{4}-c_{4}\,s_{5}\,s_{6} & -c_{4}\,c_{5} & -c_{4}\,c_{5}\,d_{6}\\ c_{4}\,s_{6}+c_{6}\,s_{4}\,s_{5} & c_{4}\,c_{6}-s_{4}\,s_{5}\,s_{6} & -c_{5}\,s_{4} & -c_{5}\,d_{6}\,s_{4}\\ c_{5}\,c_{6} & -c_{5}\,s_{6} & s_{5} & d_{6}\,s_{5}\\ 0 & 0 & 0 & 1 \end{array}\right) $$ which I think is the right one.
PS:
I did tried my method with different orientation for frame 4 (x-axis flipped 180) and frame 5 (x-axis flipped 180) and I get the same final transformation matrix. If I try the one give by the textbook, I end up getting different answer.