Maybe a small example will help. Here is the xsl code stripped down.
<?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl:output method="xml" indent="yes"/> <xsl:variable name="woodstoxct" select="count(//dependencies/dependency[normalize-space(groupId)='woodstox' and normalize-space(artifactId)='wstx-asl'])"/> <xsl:template match="/ | @* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template> <xsl:template match='dependency'> <xsl:choose> <xsl:when test="./groupId='woodstox' and ./artifactId='wstx-asl'"> <xsl:call-template name="axis2dep"/> </xsl:when> <xsl:otherwise> <xsl:copy-of select="."/> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name="axis2dep"> <xsl:comment> found <xsl:value-of select='$woodstoxct'/> Woodstox artifact(s) </xsl:comment> <xsl:copy> <groupId>artifact group</groupId> <artifactId>some artifact</artifactId> <version>1.0</version> <scope>provided</scope> </xsl:copy> </xsl:template></xsl:stylesheet>
When I run it against this xml it works and replaces the woodstox artifact
<?xml version="1.0" encoding="UTF-8"?><project> <dependencies> <dependency> <groupId>woodstox</groupId> <artifactId>wstx-asl</artifactId> </dependency> </dependencies></project>
If <project> is changed to have a name space as follows, it does not replace the woodstox artifact.
<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <dependencies> <dependency> <groupId>woodstox</groupId> <artifactId>wstx-asl</artifactId> </dependency> </dependencies></project>