* fix baseurl before links with ://

This commit is contained in:
vv01f 2019-09-17 09:25:32 +02:00
parent 7c2c8c51d4
commit 8f8b198c84
Signed by untrusted user who does not match committer: vv01f
GPG Key ID: 02625A16AC1D1FF6
1 changed files with 58 additions and 12 deletions

View File

@ -47,18 +47,55 @@
<xsl:attribute name="id">ds<xsl:value-of select="$id"/></xsl:attribute>
<xsl:element name="div">
<xsl:attribute name="class">schleudercover</xsl:attribute>
<xsl:element name="a">
<xsl:attribute name="href"><xsl:value-of select="concat($protocol,$baseurl,link)"/></xsl:attribute>
<xsl:element name="img">
<xsl:attribute name="src"><xsl:value-of select="image"/></xsl:attribute>
<xsl:attribute name="alt"><xsl:value-of select="$alt"/></xsl:attribute>
<xsl:attribute name="height">93</xsl:attribute>
</xsl:element>
</xsl:element>
<xsl:choose>
<xsl:when test="link != ''">
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:choose>
<xsl:when test="contains(link,'://')">
<xsl:value-of select="link"/>
</xsl:when>
<!--xsl:when test="contains(link,'mailto:')">
<xsl:value-of select="link"/>
</xsl:when-->
<xsl:otherwise>
<xsl:value-of select="concat($protocol,$baseurl,link)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:element name="img">
<xsl:attribute name="src"><xsl:value-of select="image"/></xsl:attribute>
<xsl:attribute name="alt"><xsl:value-of select="$alt"/></xsl:attribute>
<xsl:attribute name="height">93</xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:element name="img">
<xsl:attribute name="src"><xsl:value-of select="image"/></xsl:attribute>
<xsl:attribute name="alt"><xsl:value-of select="$alt"/></xsl:attribute>
<xsl:attribute name="height">93</xsl:attribute>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:element><xsl:value-of select="concat(@id,' ')"/>
<xsl:for-each select="link">
<xsl:call-template name="anchorlink">
<xsl:with-param name="linkdata" select="concat($protocol,$baseurl,.)" />
<xsl:with-param name="linkdata">
<xsl:value-of select="." />
</xsl:with-param>
<xsl:with-param name="baseuri">
<xsl:choose>
<xsl:when test="contains(., '://')"></xsl:when>
<!--xsl:when test="contains(., '')"></xsl:when--><!-- other conditions could be applicable without the "//" in uri, e.g. "mailto:john@doe.com" -->
<!--xsl:when test="contains(., 'mailto:')">
<xsl:value-of select=""/>
</xsl:when-->
<xsl:otherwise>
<xsl:value-of select="concat($protocol,$baseurl)" />
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</xsl:for-each>
<xsl:if test="not(link)"><!-- fix for no icon glitch -->
@ -79,6 +116,7 @@
<xsl:template name="anchorlink">
<xsl:param name="linkdata" />
<xsl:param name="typedata" />
<xsl:param name="baseuri" /><!-- todo: replace baseuri with "./" if it is $baseurl, take care of linkdata starting with "/" or "." -->
<xsl:choose>
<xsl:when test="not($typedata)">
<xsl:variable name="t">
@ -90,10 +128,18 @@
</xsl:choose>
</xsl:variable>
<xsl:call-template name="anchorlink">
<xsl:with-param name="linkdata" select="$linkdata" />
<xsl:with-param name="typedata" select="$t" />
<xsl:with-param name="linkdata">
<xsl:choose>
<xsl:when test="not($baseuri)">
<xsl:value-of select="$linkdata"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($baseuri,$linkdata)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
<xsl:with-param name="typedata" select="$t" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:element name="a">