Extracting XML from XML
Im having problems extracting certain snippets of XML from a file using XSLT. I have a massive XML file thats multilayed
Example i've mocked up:
<RESULT>
<EXPL>
<RUN_CONTEXT>
<APPLICATION></APPLICATION>
</RUN_CONTEXT>
</EXPL>
</RESULT
The trouble is when i run it It will output the tags and data i want but it also outputs the whole XML (or most of it) without tags... now i think this is something to do with the match and value-of somehow playing up but does anyone know how to fix this or a better way to do it?
----------------XSLT--------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:template match="run_context | application | xml_module | os_description | legal_statement">
<xsl:element name="{name()}" >
<xsl:for-each select="@*">
<xsl:attribute name="{name()}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:for-each>
<xsl:apply-templates select="*|text()"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
|