Skip to content

allow text content in <date> #6

@jjarosch

Description

@jjarosch

cf. TEI-Correspondence-SIG/CMIF#37

Is a <date> with only text content and no attribute ok?

<xsl:template match="tei:date[1]">
<!-- check if any of the dating attributes are present and not empty -->
<xsl:if test="normalize-space(string-join(@when | @notBefore | @notAfter | @from | @to))">
<date xmlns="http://www.tei-c.org/ns/1.0">
<!-- only retain allowed attributes -->
<xsl:for-each select="(@when | @notBefore | @notAfter | @from | @to)">
<!-- only three types of notation are allowed – discard all others -->
<!-- TODO: when none of the attributes conform, the resulting date element is empty -->
<xsl:if test="matches(., '^\d{4}(-\d{2}){0,2}$')">
<xsl:copy/>
</xsl:if>
</xsl:for-each>
</date>
</xsl:if>
</xsl:template>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions