Matt Wringe 08dabf
Matt Wringe 08dabf
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
Matt Wringe 08dabf
 <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/> 
Matt Wringe 08dabf
 <xsl:strip-space elements="*"/> 
Matt Wringe 08dabf
 <xsl:template match="*[name() != 'dependencies']|*/text()">
Matt Wringe 08dabf
     <xsl:apply-templates/>
Matt Wringe 08dabf
 </xsl:template>
Matt Wringe 08dabf
 <xsl:template match="//dependencies">
Matt Wringe 08dabf
  <xsl:for-each select="./dependency">
Matt Wringe 08dabf
   <xsl:element name="dependency">
Matt Wringe 08dabf
    <xsl:element name="maven">
Matt Wringe 08dabf
     <xsl:choose>
Matt Wringe 08dabf
      <xsl:when test="./groupId">
Matt Wringe 08dabf
       <xsl:copy-of select="./groupId"/>
Matt Wringe 08dabf
       <xsl:copy-of select="./artifactId"/>
Matt Wringe 08dabf
      </xsl:when>
Matt Wringe 08dabf
      <xsl:when test="./id">
Matt Wringe 08dabf
       <xsl:choose>
Matt Wringe 08dabf
        <xsl:when test="substring-before(./id/text(),':') != ''">
Matt Wringe 08dabf
         <xsl:element name="groupId">
Matt Wringe 08dabf
          <xsl:value-of select="substring-before(./id/text(),':')"/>
Matt Wringe 08dabf
         </xsl:element>
Matt Wringe 08dabf
         <xsl:element name="artifactId">
Matt Wringe 08dabf
          <xsl:value-of select="substring-after(./id/text(),':')"/>
Matt Wringe 08dabf
         </xsl:element>
Matt Wringe 08dabf
        </xsl:when>
Matt Wringe 08dabf
        <xsl:otherwise>
Matt Wringe 08dabf
         <xsl:element name="groupId">
Matt Wringe 08dabf
          <xsl:value-of select="./id/text()"/>
Matt Wringe 08dabf
         </xsl:element>
Matt Wringe 08dabf
         <xsl:element name="artifactId">
Matt Wringe 08dabf
          <xsl:value-of select="./id/text()"/>
Matt Wringe 08dabf
         </xsl:element>
Matt Wringe 08dabf
        </xsl:otherwise>
Matt Wringe 08dabf
       </xsl:choose>
Matt Wringe 08dabf
      </xsl:when>
Matt Wringe 08dabf
      <xsl:otherwise>
Matt Wringe 08dabf
ERROR
Matt Wringe 08dabf
      </xsl:otherwise>
Matt Wringe 08dabf
     </xsl:choose>
Matt Wringe 08dabf
     <xsl:for-each select="./*">
Matt Wringe 08dabf
      <xsl:if test="(name() != 'groupId') and (name() != 'artifactId') and (name() != 'id')">
Matt Wringe 08dabf
       <xsl:copy-of select="."/>
Matt Wringe 08dabf
      </xsl:if>
Matt Wringe 08dabf
     </xsl:for-each>
Matt Wringe 08dabf
    </xsl:element>
Matt Wringe 08dabf
    <xsl:element name="jpp">
Matt Wringe 08dabf
     <xsl:element name="groupId">JPP</xsl:element>
Matt Wringe 08dabf
     <xsl:choose>
Matt Wringe 08dabf
      <xsl:when test="./artifactId">
Matt Wringe 08dabf
       <xsl:copy-of select="./artifactId"/>
Matt Wringe 08dabf
      </xsl:when>
Matt Wringe 08dabf
      <xsl:when test="./id">
Matt Wringe 08dabf
       <xsl:choose>
Matt Wringe 08dabf
        <xsl:when test="substring-after(./id/text(),':') != ''">
Matt Wringe 08dabf
         <xsl:element name="artifactId">
Matt Wringe 08dabf
          <xsl:value-of select="substring-after(./id/text(),':')"/>
Matt Wringe 08dabf
         </xsl:element>
Matt Wringe 08dabf
        </xsl:when>
Matt Wringe 08dabf
        <xsl:otherwise>
Matt Wringe 08dabf
         <xsl:element name="artifactId">
Matt Wringe 08dabf
          <xsl:value-of select="./id/text()"/>
Matt Wringe 08dabf
         </xsl:element>
Matt Wringe 08dabf
        </xsl:otherwise>
Matt Wringe 08dabf
       </xsl:choose>
Matt Wringe 08dabf
      </xsl:when>
Matt Wringe 08dabf
      <xsl:otherwise>
Matt Wringe 08dabf
ERROR
Matt Wringe 08dabf
      </xsl:otherwise>
Matt Wringe 08dabf
     </xsl:choose>
Matt Wringe 08dabf
     <xsl:element name="jar">
Matt Wringe 08dabf
      <xsl:choose>
Matt Wringe 08dabf
       <xsl:when test="./artifactId">
Matt Wringe 08dabf
        <xsl:value-of select="./artifactId/text()"/>
Matt Wringe 08dabf
       </xsl:when>
Matt Wringe 08dabf
       <xsl:when test="./id">
Matt Wringe 08dabf
        <xsl:choose>
Matt Wringe 08dabf
         <xsl:when test="substring-after(./id/text(),':') != ''">
Matt Wringe 08dabf
          <xsl:value-of select="substring-after(./id/text(),':')"/>
Matt Wringe 08dabf
         </xsl:when>
Matt Wringe 08dabf
         <xsl:otherwise>
Matt Wringe 08dabf
          <xsl:value-of select="./id/text()"/>
Matt Wringe 08dabf
         </xsl:otherwise>
Matt Wringe 08dabf
        </xsl:choose>
Matt Wringe 08dabf
       </xsl:when>
Matt Wringe 08dabf
       <xsl:otherwise>
Matt Wringe 08dabf
ERROR
Matt Wringe 08dabf
       </xsl:otherwise>
Matt Wringe 08dabf
      </xsl:choose>
Matt Wringe 08dabf
      <xsl:choose>
Matt Wringe 08dabf
       <xsl:when test="./type">
Matt Wringe 08dabf
        <xsl:choose>
Matt Wringe 08dabf
         <xsl:when test="./type/text() = 'plugin'">.jar</xsl:when>
Matt Wringe 08dabf
         <xsl:otherwise>.<xsl:value-of select="./type/text()"/></xsl:otherwise>
Matt Wringe 08dabf
        </xsl:choose>
Matt Wringe 08dabf
       </xsl:when>
Matt Wringe 08dabf
       <xsl:otherwise>.jar</xsl:otherwise>
Matt Wringe 08dabf
      </xsl:choose>
Matt Wringe 08dabf
     </xsl:element>
Matt Wringe 08dabf
     <xsl:for-each select="./*">
Matt Wringe 08dabf
      <xsl:if test="(name() != 'groupId') and (name() != 'artifactId') and (name() != 'id')">
Matt Wringe 08dabf
       <xsl:copy-of select="."/>
Matt Wringe 08dabf
      </xsl:if>
Matt Wringe 08dabf
     </xsl:for-each>
Matt Wringe 08dabf
    </xsl:element>
Matt Wringe 08dabf
   </xsl:element>
Matt Wringe 08dabf
  </xsl:for-each>
Matt Wringe 08dabf
 </xsl:template>
Matt Wringe 08dabf
</xsl:stylesheet>