They have both tried to change. Apple has just done so successfully.
Wrong, MS has always been a software company and they still lead in that area. MS has never decided upon moving away from Windows products to venture into other markets. Even with their WP7 product line, it was mostly a continuation of Windows CE which was used in some earlier phones and in PDA's (like the iPaq) when Palm dominated the market. MS has always produced software, there never was a Microsoft phone, Microsoft PDA, Microsoft PC.
Even with the success of their Xbox, they never intended on moving away from software to push forward with the gaming console industry. Microsoft (Windows) has always been associated with computer gaming (compared to Macintosh platforms) and it was a great way to specialize just the gaming aspect of Windows computing and creating a dedicated product to do so.
With Apple, their direction has changed, the proof of this is in the change of their company's name. From Apple Computers Inc. to just Apple Inc. Apple's no longer just a computer company and decided to diversify their attention into other areas, hence Macs and OS X isn't their bread and butter product anymore.
Mac sales are at record numbers and are increasing market share every quarter for the last five years. (21 consecutive quarters)
Even at record numbers, they're clearly not even in position to compete with MS, where's Macs at now, at around 10%~11%? Even that's being very generous, in fact the following link has 10.6 at under 4% that means there are more than twice the amount of (gag) Windows Vista users than they are OS X 10.6.
http://marketshare.hitslink.com/os-market-share.aspx?qprid=11
OS X 10.7 Lion is even worse than Linux at 1.03%
http://marketshare.hitslink.com/operating-system-market-share.aspx?qprid=10&qpcustomd=0
Here's a disconnect I'm finding about the whole Mac-PC, OS X-Windows marketshare deal. According to Macrumors back in July, I got the figure of 10~11% PC marketshare. How is it that there's that much of a discrepancy in figures is what I'm trying to figure out.
https://www.macrumors.com/2011/07/13/apple-soars-to-third-place-in-u-s-pc-market-with-10-7-share/
Even at record numbers, Macs are unable to compete with XP, an ancient release from back in 2003. What you fail to realize is that most of Mac owners also own a PC, those who don't own a PC (machine), often own a copy of Windows (for bootcamp, VM, etc.). If you look at those links, OS X sales are directly associated with Mac sales since OS X is not licensed to be used on non-Apple hardware so you'd have to own a Mac to use it in accordance with its EULA terms.
Don't get me wrong, I'm not bashing Apple in any way, in fact I see it as a clear advantage to be able to use both Macs and PCs, OS X and Windows to deal with my computing needs, I don't see anything wrong with having 2 good products to use. However in your mind I guess Apple should just quit out of the OS market because MS is ahead (based on your next quote below).
So, basically, you don't want to compare them in markets where Apple is ahead.
Compare what?