I'm using xmlstarlet to produce HTML, which works well generally. When I add these lines to the XSL file:
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXX');
</script>
I get these errors:
current.xsl:26.87: Opening and ending tag mismatch: head line 8 and script
pt async src="https://www.googletagmanager.com/gtag/js?id=G-QK0NG2KM96"></script
^
current.xsl:28.10: Opening and ending tag mismatch: html line 7 and head
</head>
^
current.xsl:120.9: Opening and ending tag mismatch: template line 5 and html
</html>
^
current.xsl:121.16: Opening and ending tag mismatch: stylesheet line 2 and template
</xsl:template>
^
current.xsl:122.1: Extra content at the end of the document
</xsl:stylesheet>
I figure the problem is the "async" appearing to be a non-legal attribute. How do I solve this?
Use the XHTML representation of the content, which I think is async="async"
.