summaryrefslogtreecommitdiffstats
path: root/doc/src/sgml/images/fixup-svg.xsl
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:15:05 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:15:05 +0000
commit46651ce6fe013220ed397add242004d764fc0153 (patch)
tree6e5299f990f88e60174a1d3ae6e48eedd2688b2b /doc/src/sgml/images/fixup-svg.xsl
parentInitial commit. (diff)
downloadpostgresql-14-46651ce6fe013220ed397add242004d764fc0153.tar.xz
postgresql-14-46651ce6fe013220ed397add242004d764fc0153.zip
Adding upstream version 14.5.upstream/14.5upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'doc/src/sgml/images/fixup-svg.xsl')
-rw-r--r--doc/src/sgml/images/fixup-svg.xsl44
1 files changed, 44 insertions, 0 deletions
diff --git a/doc/src/sgml/images/fixup-svg.xsl b/doc/src/sgml/images/fixup-svg.xsl
new file mode 100644
index 0000000..d6c46b3
--- /dev/null
+++ b/doc/src/sgml/images/fixup-svg.xsl
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ version="1.0">
+
+<!--
+Transform the SVG produced by various tools, applying assorted fixups.
+-->
+
+<!--
+Add viewBox attribute to svg element if not already present. This allows the
+image to scale.
+-->
+<xsl:template match="svg:svg">
+ <xsl:copy>
+ <xsl:if test="not(@viewBox)">
+ <xsl:attribute name="viewBox">
+ <xsl:text>0 0 </xsl:text>
+ <xsl:value-of select="@width"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="@height"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="@* | node()"/>
+ </xsl:copy>
+</xsl:template>
+
+<!--
+Fix stroke="transparent" attribute, which is invalid SVG.
+-->
+<xsl:template match="@stroke[.='transparent']">
+ <xsl:attribute name="stroke">none</xsl:attribute>
+</xsl:template>
+
+<!--
+copy everything else
+-->
+<xsl:template match="@* | node()">
+ <xsl:copy>
+ <xsl:apply-templates select="@* | node()"/>
+ </xsl:copy>
+</xsl:template>
+
+</xsl:stylesheet>