Bugfix: Now recognizing the "https://" pattern as a prefix of non-local files.
[shapes.git] / doc / tools / xhtml-deps / filter.xsl
blob26ec27f52606185e6d608c8b5052164dd43dbc20
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet version="2.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
4 <xsl:output method="text" indent="no" />
6 <xsl:template match="/html">
7 <xsl:apply-templates select="body//a[@href]" />
8 <xsl:apply-templates select="body//img[@src]" />
9 </xsl:template>
11 <xsl:template match="/html/body//a[@href]">
12 <xsl:if test="not(starts-with(@href,'http://') or starts-with(@href,'https://') or starts-with(@href,'mailto:'))">
13 <xsl:value-of select="/html/head/base/@href" />
14 <xsl:choose>
15 <xsl:when test="contains(@href,'#')">
16 <xsl:value-of select="replace(substring-before(@href,'#'),'%25','%')" />
17 </xsl:when>
18 <xsl:otherwise>
19 <xsl:value-of select="replace(@href,'%25','%')" />
20 </xsl:otherwise>
21 </xsl:choose>
22 <xsl:text> </xsl:text>
23 </xsl:if>
24 </xsl:template>
26 <xsl:template match="/html/body//img[@src]">
27 <xsl:value-of select="replace(@src,'%25','%')" /><xsl:text> </xsl:text>
28 </xsl:template>
30 </xsl:stylesheet>