We have a bunch of files that are html pages but which contain additional xml elements (all prefixed with our company name \'TLA\') to provide data and structure for an older pr
You could try something like this...
XSLT 1.0
<xsl:stylesheet version="1.0" xmlns:tla="http://www.tla.com" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="@*|node()">
<xsl:apply-templates select="@*|node()"/>
</xsl:template>
<xsl:template match="tla:*">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
This should do it:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:tla="http://www.tla.com">
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />
<xsl:strip-space elements="*" />
<xsl:template match="text()" />
<xsl:template match="tla:* | tla:*/@* | tla:*/text()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
When run on your sample input (once the missing namespace declaration is added), the result is:
<TLA:document xmlns:TLA="http://www.tla.com">
<TLA:contexts>
<TLA:context id="id_1" value="" />
</TLA:contexts>
<TLA:page>
<TLA:question id="q_id_1" />
</TLA:page>
</TLA:document>