Skip to content

Commit

Permalink
Fixed JSON escaping issue
Browse files Browse the repository at this point in the history
  • Loading branch information
lmckenzi committed Dec 6, 2023
1 parent 86011a0 commit 128cf4d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ This project manages the artifacts, pages, and other lists associated with all H

Read more about it here: <https://confluence.hl7.org/display/HL7/Configuring+Specification+Feedback>


To make pull requests against this project, create a fork in your personal Github space and submit a pull request from there. (Most users will not have permission to create branches directly within this project.)

Source content is found in the `xml` folder:
Expand Down
26 changes: 24 additions & 2 deletions tools/xmlToJson.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,37 @@
<xsl:for-each select="@*[not(contains(name(.), ':'))]">
<xsl:choose>
<xsl:when test="local-name(.)=('deprecated')">
<xsl:value-of select="concat('&quot;', local-name(.), '&quot;:', .)"/>
<xsl:value-of select="concat('&quot;', local-name(.), '&quot;:')"/>
<xsl:call-template name="escapeText">
<xsl:with-param name="text" select="."/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat('&quot;', local-name(.), '&quot;:&quot;', ., '&quot;')"/>
<xsl:value-of select="concat('&quot;', local-name(.), '&quot;:&quot;')"/>
<xsl:call-template name="escapeText">
<xsl:with-param name="text" select="."/>
</xsl:call-template>
<xsl:text>"</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="position()!=last()">,</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template name="escapeText">
<xsl:param name="text"/>
<xsl:choose>
<xsl:when test="contains($text, '&quot;')">
<xsl:value-of select="substring-before($text, '&quot;')"/>
<xsl:text>\"</xsl:text>
<xsl:call-template name="escapeText">
<xsl:with-param name="text" select="substring-after($text, '&quot;')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="doNamedArray">
<xsl:param name="name"/>
<xsl:value-of select="concat('&quot;', $name, '&quot;:')"/>
Expand Down

0 comments on commit 128cf4d

Please sign in to comment.