Jump to content

midinges

Members
  • Posts

    5
  • Joined

  • Last visited

Posts posted by midinges

  1. 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>

  2. I'm working on a translation of POM files. I have a POM file that has the following as the project stanza.<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">With the namespace information on the project statement my xsl does nothing. If I remove all the information from project and it looks like this <project> my xsl works as expected. What do I need to do to allow the template in the xsl to process this POM file?

  3. I'm working on a translation of POM files. I have a POM file that has the following as the project stanza.<project xmlns="http://maven.apache.org/POM/4.0.0"'>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">With the namespace information on the project statement my xsl does nothing. If I remove all the information from project and it looks like this <project> my xsl works as expected. What do I need to do to allow the template in the xsl to process this POM file?

×
×
  • Create New...