Hello all,
I would like to remove all elements from XML except content of element called <source>. E.g.:
<root>
<a>This will be stripped off</a>
<source>But this not</source>
</root>
After XSLT:
But this not
I have tried this but with no luck (no output):
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes"/>
<xsl:template match="source">
<xsl:copy>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@*|node()">
</xsl:stylesheet>
From comments:
In my real XML I have the source element in different namespace. I need to google how to create a match pattern for element in different namespace. I would like to put each extracted string also to newline ;-)