You cannot apply templates to unparsed (escaped or CDATA) text. See some previous answers that may be relevant to you:
Parsing html with xslt
XSLT: Reading a param that's an xml document passed as a string
how to parse the xml inside CDATA of another xml using xslt?