Example 4 Given that $\triangle XYZ$ is an isosceles right triangle with legs of length 1 $\left(\angle Z=90^{\circ}\right)$, its three vertices are on the three sides of isosceles right $\triangle ABC\left(\angle C=90^{\circ}\right)$. Find the maximum possible length of the legs of $\triangle ABC$.
$(2002$, Shanghai Junior High School Mathematics Competition)
(1) As shown in Figure 7, if vertex $Z$ is on the hypotenuse $A B$, take the midpoint $M$ of $X Y$, and connect $C M$, $Z M$, $C Z$, and draw the altitude $C N$ from $C$ to $A B$. Then
$$
\begin{array}{l}
C N \leqslant C Z \leqslant C M+M Z \\
=\frac{1}{2} X Y+\frac{1}{2} X Y=X Y=\sqrt{2} .
\end{array}
$$

Thus, $C A=\sqrt{2} C N \leqslant 2$.
(2) As shown in Figure 8, if vertex $Z$ is on the right-angle side $C A$ (or $C B$), by symmetry, assume $Z$ is on side $C A$, and draw $Y H \perp C A$ at point $H$. Let $C X=x$, $C Z=y$.
It is easy to prove $\triangle Z Y H \cong \triangle X Z C$, thus
$$
H Z=C X=x, H Y=C Z=y \text {. }
$$

Clearly, $\triangle A H Y$ is an isosceles right triangle, so $A H=y$.
Let $A C=b \geqslant 0$.
Then $2 y+x=b$, i.e., $x=b-2 y$.
In $\triangle X Z C$, by the Pythagorean theorem, we have
$$
\begin{array}{l}
y^{2}+(b-2 y)^{2}=1^{2} \\
\Rightarrow 5 y^{2}-4 b y+b^{2}-1=0 .
\end{array}
$$

By $\Delta=16 b^{2}-20\left(b^{2}-1\right) \geqslant 0$, we get $b \leqslant \sqrt{5}$.
When $b=\sqrt{5}$, $y=\frac{2 \sqrt{5}}{5}$, $x=\frac{\sqrt{5}}{5}$.
Combining (1) and (2), the maximum possible length of the right-angle side of $\triangle A B C$ is $\sqrt{5}$.