Shan,
When you say "template match='warning'", you are already in the context of the warning node. Hence
you should not mention ancestor::warning to print the ancestor of warning. When you say so, it is looking for "warning" nodes in the ancestor list of "warning" and since there are none, its printing nothing. In fact, in the example xml given by you warning node has 2 ancestors (immediate parent, its parent, so on upto the root node). Please go through the xpath pdf document by OReilly mentioned earlier for complete description of different kinds of axes.
You can also mention something like -
<xsl:for-each select="preceding::* | ancestor::*">
to select both the preceding nodes as well as the ancestors in the list.
Please come back if you have any further questions.