You made a mistake by bringing x=0 into cosx. The denominator can be brought in, but the molecular cosx cannot be brought in directly. As a polynomial whole, sinx-xcosx can only be brought in as cosx (Tanx-X) after being put forward separately, but it returns.
If the cosx in the molecule has no value, the original molecule is sinx-xcosx, and the L'H?pital derivative is cosx-cosx+xsinx=xsinx. Knowing all the later estimates can get the correct result.