Skip to content

Commit

Permalink
Output images with alt text as figures in HTML
Browse files Browse the repository at this point in the history
  • Loading branch information
adamretter committed Oct 24, 2024
1 parent 5f76409 commit 49f4536
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions cityehr-quick-start-guide/src/main/xslt/create-topic-html.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,26 @@
<xsl:apply-templates mode="body"/>
</xsl:copy>
</xsl:template>

<xsl:template match="image" mode="body">

<xsl:template match="image[alt]" mode="body">
<figure>
<img src="{@href}">
<xsl:if test="alt">
<xsl:attribute name="alt" select="alt"/>
</xsl:if>
</img>
<figcaption><xsl:value-of select="alt"/></figcaption>
</figure>
</xsl:template>

<xsl:template match="image[empty(alt)]" mode="body">
<img src="{@href}">
<xsl:if test="alt">
<xsl:attribute name="alt" select="alt"/>
</xsl:if>
</img>
</xsl:template>

<xsl:template match="xref" mode="body">
<a href="{@href}">
<xsl:apply-templates mode="body"/>
Expand Down

0 comments on commit 49f4536

Please sign in to comment.