You can write one template rule for each case:
<xsl:template match="companyAlerts[publication]">
...
</xsl:template>
<xsl:template match="companyAlerts[recommendation]">
...
</xsl:template>
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference