Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 7bfd72f405d4adf7a1cfaf2d96fd7644d01545bd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:my="http://maven.apache.org/POM/4.0.0" exclude-result-prefixes="my xs" version="1.0">
  <!--xsl:output omit-xml-declaration="yes" indent="yes"/>
  <xsl:output indent="yes"/>
  <xsl:strip-space elements="*"/-->
  <xsl:output method="xml" encoding="UTF-8"/>
  <xsl:template name="group-id">
    <xsl:param name="pText" select="."/>
    <xsl:param name="pCount" select="0"/>
    <xsl:if test="$pCount &lt; 3">
      <xsl:value-of select="substring-before(concat($pText, '.'), '.')"/>
      <xsl:if test="$pCount &lt; 2">
        <xsl:text>.</xsl:text>
      </xsl:if>
      <xsl:call-template name="group-id">
        <xsl:with-param name="pText" select="substring-after($pText, '.')"/>
        <xsl:with-param name="pCount" select="$pCount + 1"/>
      </xsl:call-template>
    </xsl:if>
  </xsl:template>
  <xsl:template match="/my:project/my:groupId">
    <groupId xmlns="http://maven.apache.org/POM/4.0.0">
      <xsl:call-template name="group-id">
        <xsl:with-param name="pText" select="/my:project/my:artifactId/text()"/>
        <xsl:with-param name="pCount" select="0"/>
      </xsl:call-template>
    </groupId>
  </xsl:template>
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>
  <!--xsl:template match="node()|@*">
  <xsl:copy>
    <xsl:apply-templates select="node()|@*">
      <xsl:sort select="name()" />
      <xsl:sort select="@*" />
    </xsl:apply-templates>
  </xsl:copy>
</xsl:template-->
</xsl:stylesheet>

Back to the top