<!--
Nick's web site: SVG embedding.
- Copyright © 2021 Nick Bowler
+ Copyright © 2021-2022 Nick Bowler
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
<xsl:value-of select='concat("es-", generate-id($idnode))' />
</xsl:attribute>
</xsl:if>
- <xsl:apply-templates mode='embed-svg' select='@*[local-name()!="id"]' />
+ <xsl:choose>
+ <xsl:when test='$idnode/@src and not(parent::*)'>
+ <!-- remove .svg suffix -->
+ <xsl:variable name='raw'
+ select='substring($idnode/@src, 1, string-length($idnode/@src)-4)' />
+
+ <xsl:attribute name='class'>
+ <xsl:value-of select='normalize-space(concat(@class, " embed ",
+ translate($raw, "/", " ")))' />
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode='embed-svg' select='@class' />
+ </xsl:otherwise>
+ </xsl:if>
+ <xsl:apply-templates mode='embed-svg'
+ select='@*[local-name()!="id" and local-name()!="class"]' />
<xsl:apply-templates mode='embed-svg' select='node()'>
<xsl:sort select='-count(self::svg:metadata)' data-type='number' />
</xsl:apply-templates>