Skip to content

Commit 0cfbd1e

Browse files
author
p12
committed
Preprocess: remove query string from links to the css files
1 parent a6d8db2 commit 0cfbd1e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

preprocess.xsl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888

8989
<!-- update links to resources: -->
9090
<xsl:template match="//@href | //@src">
91-
<xsl:attribute name="{name()}">
91+
<xsl:variable name="fixed_url">
9292
<xsl:choose>
9393
<xsl:when test="contains(.,'../../upload.cppreference.com/mwiki/')">
9494
<xsl:value-of select="str:replace(.,'../../upload.cppreference.com/mwiki/','../common/')"/>
@@ -97,6 +97,16 @@
9797
<xsl:value-of select="str:replace(.,'../mwiki/','../common/')"/>
9898
</xsl:otherwise>
9999
</xsl:choose>
100+
</xsl:variable>
101+
<xsl:attribute name="{name()}">
102+
<xsl:choose>
103+
<xsl:when test="contains($fixed_url, '.css?') or contains($fixed_url, '.php?')">
104+
<xsl:copy-of select="substring-before($fixed_url,'?')"/>
105+
</xsl:when>
106+
<xsl:otherwise>
107+
<xsl:copy-of select="$fixed_url"/>
108+
</xsl:otherwise>
109+
</xsl:choose>
100110
</xsl:attribute>
101111
</xsl:template>
102112

0 commit comments

Comments
 (0)