Skip to content

Commit

Permalink
passing rng declarations through to a JSON object as string literal
Browse files Browse the repository at this point in the history
  • Loading branch information
raffazizzi committed Nov 5, 2024
1 parent 1652202 commit bd33528
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions odds/odd2json.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
xmlns:math="http://www.w3.org/2005/xpath-functions/math"
xmlns:tei="http://www.tei-c.org/ns/1.0"
xmlns:j="http://www.w3.org/2005/xpath-functions"
xmlns:rng="http://relaxng.org/ns/structure/1.0"
exclude-result-prefixes="xs math"
version="3.0">

Expand Down Expand Up @@ -142,7 +143,7 @@
<xsl:sequence select="$source"/>
</xsl:otherwise>
</xsl:choose>
</xsl:function>
</xsl:function>

<xsl:function name="tei:getClassType" as="xs:string">
<xsl:param name="context"/>
Expand Down Expand Up @@ -421,6 +422,13 @@
</xsl:for-each>
</j:array>
</xsl:when>
<xsl:when test="self::rng:*">
<!-- RNG elements are not converted to JSON, just serialized -->
<j:string key="type">rng</j:string>
<j:string key="rngContent">
<xsl:value-of select="serialize(.)" />
</j:string>
</xsl:when>
<xsl:otherwise>
<j:string key="type"><xsl:value-of select="local-name()"/></j:string>
</xsl:otherwise>
Expand Down Expand Up @@ -498,7 +506,14 @@
</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</j:string>
</j:string>
<xsl:for-each select="rng:*">
<!-- RNG elements are not converted to JSON, just serialized -->
<j:string key="type">rng</j:string>
<j:string key="rngContent">
<xsl:value-of select="serialize(.)" />
</j:string>
</xsl:for-each>
<xsl:for-each select="tei:dataRef">
<j:map key="dataRef">
<xsl:call-template name="getDataRef"/>
Expand Down

0 comments on commit bd33528

Please sign in to comment.