Skip to content

Commit

Permalink
resolve issue #5 – CMIF v2 is now passed through
Browse files Browse the repository at this point in the history
  • Loading branch information
jjarosch committed Dec 4, 2024
1 parent 8cf0ee2 commit 9cd62c0
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ Subset `<correspDesc>` elements in individual letter files for (strict) conforma

If this behaviour is too restrictive for your use case, a possible solution might be to first do a project-specific transformation to re-order/select your desired elements.

For CMIF version 2 compatibility, the `<note>` and the `<ref>` elements in it are passed through by this function. (Currently, the CMIFerator contains no mechanism to create these elements.)

##### Configuration parameter used by this function

Currently, the CMIFerator makes the hard assumption that the permalinks for your letters will be concatenated from a base URL and the `@xml:id` attribute of the root `<TEI>` element. This may be subject to change in future versions.
Expand Down
30 changes: 29 additions & 1 deletion library-package/content/correspDesc-transform.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<persName><xsl:value-of select="$unknown"/></persName>
</correspAction>
</xsl:if>
<xsl:apply-templates select="tei:correspAction"/>
<xsl:apply-templates select="(tei:correspAction | tei:note)"/>
</correspDesc>
</xsl:template>
<!-- only keep one correspDesc per file (pick the first one) -->
Expand Down Expand Up @@ -157,4 +157,32 @@
</xsl:template>


<!-- note -->

<xsl:template match="tei:note[1]">
<xsl:if test="./tei:ref[@type][@target]">
<note xmlns="http://www.tei-c.org/ns/1.0">
<xsl:apply-templates select="tei:ref"/>
</note>
</xsl:if>
</xsl:template>
<xsl:template match="tei:note[position() &gt; 1]"/>


<!-- ref -->

<xsl:template match="tei:ref">
<xsl:if test=".[matches(@type, '^https://lod.academy/cmif/vocab/terms#')][normalize-space(@target)]">
<ref xmlns="http://www.tei-c.org/ns/1.0">
<xsl:attribute name="type">
<xsl:value-of select="@type"/>
</xsl:attribute>
<xsl:attribute name="target">
<xsl:value-of select="@target"/>
</xsl:attribute>
</ref>
</xsl:if>
</xsl:template>


</xsl:stylesheet>
2 changes: 1 addition & 1 deletion library-package/expath-pkg.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<package xmlns="http://expath.org/ns/pkg" name="http://www.digitale-akademie.de/cmiferator" abbrev="cmiferator" version="0.0.4" spec="1.0">
<package xmlns="http://expath.org/ns/pkg" name="http://www.digitale-akademie.de/cmiferator" abbrev="cmiferator" version="0.1.0" spec="1.0">
<title>CMIFerator</title>
<xquery>
<namespace>http://www.digitale-akademie.de/cmiferator</namespace>
Expand Down

0 comments on commit 9cd62c0

Please sign in to comment.