enketo-transformer
Version:
Library that transforms ODK-compliant XForms into a format that Enketo can consume
6 lines (5 loc) • 2.16 kB
JavaScript
const xslModel = '\n\n<!--\n*****************************************************************************************************\nXSLT Stylesheet that transforms OpenRosa style (X)Forms instance to an xml instance that can be used\ninside Enketo Smart Paper.\n*****************************************************************************************************\n-->\n\n<!-- \nThese namespace-declarations have been carefully crafted to produce a fairly clean output. \nThis includes the duplicate default namespace and xf: prefixed namespace. \nEdit with care!\n-->\n<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" \n xmlns:xf="http://www.w3.org/2002/xforms" \n xmlns:h="http://www.w3.org/1999/xhtml" \n xmlns:ev="http://www.w3.org/2001/xml-events" \n xmlns:xsd="http://www.w3.org/2001/XMLSchema" \n xmlns="http://www.w3.org/2002/xforms" version="1.0">\n <xsl:output method="xml" indent="yes" omit-xml-declaration="yes" version="1.0" encoding="UTF-8" />\n\n <xsl:template match="/">\n <root>\n <model>\n <xsl:apply-templates select="//xf:model/@*" mode="include-namespace-declarations"/>\n <xsl:apply-templates select="//xf:model/xf:instance" />\n </model>\n </root>\n </xsl:template>\n\n <xsl:template match="xf:instance">\n <instance>\n <xsl:apply-templates select="@*"/>\n <!-- \n This forces namespace declarations on the child of instance, which makes it easier to\n serialize that child for a submission without duplications of namespace declarations.\n -->\n <xsl:copy-of select="node()" />\n </instance>\n </xsl:template>\n\n <xsl:template match="@*">\n <xsl:attribute name="{name()}">\n <xsl:value-of select="." />\n </xsl:attribute>\n </xsl:template>\n\n <xsl:template match="@*" mode="include-namespace-declarations">\n <xsl:copy-of select="."/>\n </xsl:template>\n\n</xsl:stylesheet>\n';
export {
xslModel as default
};
//# sourceMappingURL=openrosa2xmlmodel.xsl.js.map