Minor fixes to allow rendering IP metadata from old R-builds.
- Parse the fully qualified version from within metadata repository
- Don't display a source link if one does not exist
diff --git a/scripts/repo-index.xsl b/scripts/repo-index.xsl
index 23ca615..2c6c1de 100644
--- a/scripts/repo-index.xsl
+++ b/scripts/repo-index.xsl
@@ -11,7 +11,13 @@
<xsl:for-each select="/repository/units/unit[provides/provided/@namespace = 'org.eclipse.equinox.p2.eclipse.type' and provides/provided/@name = 'bundle']">
<xsl:sort select="@id"/>
<xsl:if test="properties/property[@name='iplog.bug_id']">
+ <xsl:variable name="id" select="@id"/>
<xsl:variable name="email" select="properties/property[@name='iplog.contact.email']/@value"/>
+ <!-- Get the version to the left of the 'v'
+ Example: 1.2.3.v201611291555 gives 1.2.3. -->
+ <xsl:variable name="vleft" select="substring-before(@version,'v')"/>
+ <!-- Remove the last character -->
+ <xsl:variable name="vfinal" select="substring($vleft,1,string-length($vleft)-1)"/>
<tr valign="top">
<td width="20%" >
@@ -20,13 +26,20 @@
</a>
</td>
<td width="5%">
+ <!-- Only show source link if source bundle exists -->
+ <xsl:if test="../unit[@id=concat($id,'.source')]">
<a href="{$repoPath}/plugins/{@id}.source_{@version}.jar">
(source)
</a>
+ </xsl:if>
</td>
<td width="5%">
- <!-- translate() replaces individual characters -->
- <xsl:value-of select="translate(properties/property[@name='maven-version']/@value,'-SNAPSHOT','')" />
+ <!-- Hack for conditional expression -->
+ <!-- Use the fact that 1/0 = Infinity and substring($foo, Infinity)
+ returnes the empty string -->
+ <xsl:value-of select="concat(
+ substring($vfinal, 1 div boolean(contains(@version,'v'))),
+ substring(@version, 1 div not(contains(@version,'v'))))" />
</td>
<td width="8%">
<a href="https://dev.eclipse.org/ipzilla/show_bug.cgi?id={properties/property[@name='iplog.bug_id']/@value}">