]> git.mxchange.org Git - friendica-addons.git/blob - retriever/templates/fix-urls.tpl
Additional work for PR 3778
[friendica-addons.git] / retriever / templates / fix-urls.tpl
1 <?xml version="1.0" encoding="utf-8"?>
2
3 <!-- attempt to replace relative URLs with absolute URLs -->
4 <!-- http://stackoverflow.com/questions/3824631/replace-href-value-in-anchor-tags-of-html-using-xslt -->
5
6 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
7   <xsl:output method="xml"/>
8
9   <xsl:template match="node()|@*">
10     <xsl:copy>
11       <xsl:apply-templates select="node()|@*"/>
12     </xsl:copy>
13   </xsl:template>
14
15   <xsl:template match="*/@src[starts-with(.,'.')]">
16     <xsl:attribute name="src">
17       <xsl:value-of select="concat('{{$dirurl}}',.)"/>
18     </xsl:attribute>
19   </xsl:template>
20   <xsl:template match="*/@src[starts-with(.,'/')]">
21     <xsl:attribute name="src">
22       <xsl:value-of select="concat('{{$rooturl}}',.)"/>
23     </xsl:attribute>
24   </xsl:template>
25
26 </xsl:stylesheet>