Skip to content

Commit

Permalink
Fix Release Page In Firefox Bug #167 (#177)
Browse files Browse the repository at this point in the history
-Release page would not run on firefox due to xml styler xsl.
-Replaced xsl styler with xml-formatter.
  • Loading branch information
eddiesarevalo authored Dec 22, 2022
1 parent a7316d0 commit c826f95
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 19 deletions.
33 changes: 33 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"redux-saga": "^1.1.3",
"styled-components": "^5.3.5",
"xlsx": "^0.17.0",
"xml-formatter": "^3.2.0",
"xml-js": "^1.6.11"
},
"scripts": {
Expand Down
23 changes: 4 additions & 19 deletions src/utils/xmlUtil.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,8 @@
const printXML = (sourceXml) => {
var xmlDoc = new DOMParser().parseFromString(sourceXml, 'application/xml');
var xsltDoc = new DOMParser().parseFromString([
'<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">',
' <xsl:strip-space elements="*"/>',
' <xsl:template match="para[content-style][not(text())]">',
' <xsl:value-of select="normalize-space(.)"/>',
' </xsl:template>',
' <xsl:template match="node()|@*">',
' <xsl:copy><xsl:apply-templates select="node()|@*"/></xsl:copy>',
' </xsl:template>',
' <xsl:output indent="yes"/>',
'</xsl:stylesheet>'
].join('\n'), 'application/xml');
import xmlFormat from 'xml-formatter';

var xsltProcessor = new XSLTProcessor();
xsltProcessor.importStylesheet(xsltDoc);
var resultDoc = xsltProcessor.transformToDocument(xmlDoc);
var resultXml = new XMLSerializer().serializeToString(resultDoc);
return resultXml;
const printXML = (sourceXml) => {
var styledXml = xmlFormat(sourceXml);
return styledXml;
};

const findXmlTag = (sourceXml, tag) => {
Expand Down

0 comments on commit c826f95

Please sign in to comment.