Skip to content

Commit

Permalink
OGC xslt updated for video support, metanorma/mn2pdf#227
Browse files Browse the repository at this point in the history
  • Loading branch information
Intelligent2013 committed Nov 16, 2023
1 parent 66d4f4c commit b7e0574
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions xslt_src/ogc.standard.core.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
xmlns:mathml="http://www.w3.org/1998/Math/MathML"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:fox="http://xmlgraphics.apache.org/fop/extensions"
xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf"
xmlns:java="http://xml.apache.org/xalan/java"
exclude-result-prefixes="java"
version="1.0">

<xsl:output version="1.0" method="xml" encoding="UTF-8" indent="no"/>

<xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure' or local-name() = 'localized-strings')] and not(ancestor::*[local-name() = 'name']))]" use="@reference"/>

<xsl:key name="attachments" match="ogc:video[@embedded = 'true']" use="@src"/>

<xsl:variable name="namespace">ogc</xsl:variable>

Expand Down Expand Up @@ -188,6 +191,10 @@

<fo:declarations>
<xsl:call-template name="addPDFUAmeta"/>
<xsl:for-each select="//*[local-name() = 'video'][@embedded = 'true'][generate-id(.)=generate-id(key('attachments',@src)[1])]">
<xsl:variable name="url" select="concat('url(file:',$basepath, @src, ')')"/>
<pdf:embedded-file src="{$url}" filename="{@src}"/>
</xsl:for-each>
</fo:declarations>

<xsl:call-template name="addBookmarks">
Expand Down Expand Up @@ -1566,4 +1573,22 @@
</fo:static-content>
</xsl:template>

<xsl:template match="ogc:video">
<fo:inline xsl:use-attribute-sets="eref-style" color="rgb(63,72,204)">
<xsl:variable name="url">
<xsl:choose>
<xsl:when test="@embedded = 'true'">
<xsl:value-of select="concat('url(embedded-file:', @src, ')')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@src"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<fo:basic-link external-destination="{$url}" fox:alt-text="Video {@src}">
<xsl:value-of select="@src"/>
</fo:basic-link>
</fo:inline>
</xsl:template>

</xsl:stylesheet>

0 comments on commit b7e0574

Please sign in to comment.