SAA-SDT / EAS-TagLibraries

Tag Libraries for Encoded Archival Description Version 3 and Encoded Archival Context: Corporate Bodies, Persons, and Families
7 stars 5 forks source link

Display of empty elements in EAC Tag Library examples #89

Closed ailie-s closed 2 years ago

ailie-s commented 2 years ago

When empty elements are used in examples in the tag library, closing tags are being added in the transformations to both HTML and PDF versions.

Creator of issue

  1. Ailie Smith (@ailie-s)

The issue relates to

Wanted change/feature

Reporting a bug

For example, in EAC: <entityType value="person"/>

is displaying as: <entityType value="person"></entityType>

As <entityType> cannot have any content in EAC-CPF v2.0, it would be preferable if it was displayed as <entityType value="person"/> in the tag libraries.

Suggested Solution

Steps to Reproduce (for bugs)

  1. See for example <entityType> in https://github.com/ailie-s/EAS-TagLibraries/blob/master/tei/eac.pdf, https://github.com/ailie-s/EAS-TagLibraries/blob/master/html/eac.html and https://github.com/ailie-s/EAS-TagLibraries/blob/master/tei/EAC-CPF-v2-TL-eng.xml

Context

Your Environment can be a clue to a bug

ailie-s commented 2 years ago

Potential fix for tagLibrary2pdf.xsl below. The same does not work for tagLibrary2html.xsl.

<xsl:template
        match="eac-cpf:* | eac:* |example:* | ead:* | ead3:* | mods:* | text:* | dc:* | oai_dc:* | premis:*">
        <xsl:variable name="myDepth"
            select="count(ancestor::*[not(namespace-uri() = 'http://www.tei-c.org/ns/1.0')]) * 5"/>
        <fo:block start-indent="body-start() + {$myDepth}mm" wrap-option="wrap">

                    <xsl:call-template name="newLine"/>
                    <xsl:text>&lt;</xsl:text>
                    <xsl:value-of select="local-name()"/>
                    <xsl:for-each select="@*">
                        <xsl:text>&#x20;</xsl:text>
                        <xsl:choose>
                            <xsl:when
                                test="namespace-uri() = 'http://workaround for xml namespace restriction/namespace'">
                                <xsl:text>xml:</xsl:text>
                                <xsl:value-of select="local-name()"/>
                            </xsl:when>
                            <xsl:when test="namespace-uri() = 'http://www.w3c.org/1999/xlink'">
                                <xsl:text>xlink:</xsl:text>
                                <xsl:value-of select="local-name()"/>
                            </xsl:when>
                            <xsl:when test="local-name() = 'schemaLocation'">
                                <xsl:text>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" </xsl:text>
                                <xsl:text>xsi:schemaLocation</xsl:text>
                            </xsl:when>
                            <xsl:otherwise>
                                <xsl:value-of select="local-name()"/>
                            </xsl:otherwise>
                        </xsl:choose>
                        <xsl:text>="</xsl:text>
                        <xsl:value-of select="."/>
                        <xsl:text>"</xsl:text>
                    </xsl:for-each>
            <xsl:choose>    
            <xsl:when test="exists(text())">
                    <xsl:text>&gt;</xsl:text>
                    <xsl:apply-templates select="* | text()"/>
                    <fo:inline keep-together.within-line="always" keep-with-previous.within-line="always">
                        <xsl:text>&lt;/</xsl:text>
                        <xsl:value-of select="local-name()"/>
                        <xsl:text>&gt;</xsl:text>
                    </fo:inline>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:text>/&gt;</xsl:text>
                </xsl:otherwise>
            </xsl:choose>
        </fo:block>
    </xsl:template>
alexduryee commented 2 years ago

Resolved in #92 - thanks @ailie-s !