Is it possible to check the type of a node I matched with a template inside the same template? In case it is, how can I do it? For example I would like to do something like
Take a look at this answer here, as this should give you the information you need:
Difference between: child::node() and child::*
This gives the following xsl:choose to test all the nodes, including the document node.
Root Element Text Comment PI Attribute