For a BizTalk solution I needed to write some custom XSLT. In the XSLT I needed to determine the node type and according to the type execute a specific piece of XSLT. Unfortunately it’s not very easy to get the node type in XSLT. It took me a while to find this post which explains a solution for this. Maybe it could help you out.

http://www.stylusstudio.com/xsllist/200312/post00260.html