Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 15th, 2005, 10:52 AM
Authorized User
 
Join Date: Jun 2003
Location: , , .
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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>




Similar Threads
Thread Thread Starter Forum Replies Last Post
Extracting subset of XML using XSLT sentah XSLT 3 September 3rd, 2008 02:44 PM
SQL Server 2005 XML: FOR XML PATH -> cdata? stoves SQL Server 2005 1 July 8th, 2008 02:40 AM
Extracting portion of XML ** Need help asap** aintvoguish XSLT 3 December 20th, 2007 09:12 AM
xml invalid top level from ASP write XML(solution) g000we XML 0 August 9th, 2006 03:56 AM
DTS Package, XML task. Read XML file and store it Victoria SQL Server DTS 0 July 24th, 2006 02:43 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.