You haven't given enough information for a precise answer.
<xsl:if> can never be used around an <xsl:with-param>, it can only be used around an instruction.
<xsl:if test = "/etd/entities/entity/data/@class = 'client_ip'"> tests whether such an entity exists anywhere in the document (because you're selecting starting from "/", the root node). You probably want to test whether the current entity has data/@class = 'client_ip'. If the current node is an entity node, use <xsl:if test = "data/@class = 'client_ip'">
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference