Jump to content

midinges

Members
  • Posts

    5
  • Joined

  • Last visited

midinges's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Tryied it and got this. pom-version.xsl:29:69: Fatal Error! Prefix must resolve to a namespace: {http
  2. 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>
  3. Thanks for the response, neither of those solutions worked.
  4. 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?
  5. 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...