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:17:33 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:17:33 +0000
commit5e45211a64149b3c659b90ff2de6fa982a5a93ed (patch)
tree739caf8c461053357daa9f162bef34516c7bf452 /doc/src/sgml/images/fixup-svg.xsl
parentInitial commit. (diff)
downloadpostgresql-15-5e45211a64149b3c659b90ff2de6fa982a5a93ed.tar.xz
postgresql-15-5e45211a64149b3c659b90ff2de6fa982a5a93ed.zip
Adding upstream version 15.5.upstream/15.5
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>