Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
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 November 26th, 2015, 02:01 PM
Authorized User
 
Join Date: Nov 2015
Posts: 12
Thanks: 4
Thanked 0 Times in 0 Posts
Default Need to remove first level node using XSLT in XML

Input: <?xml version="1.0" encoding="UTF-8"?>
<RECORDS>
<Login>
<Name>User Name</Name>
<LLogin>Last Login</LLogin>
</Login>
<Login>
<Name>AMARATHA</Name>
<LLogin>10/19/2015 12:33</LLogin>
</Login>
</RECORDS>

I need XSLT code for below output:
<RECORDS>
<Login>
<Name>AMARATHA</Name>
<LLogin>10/19/2015 12:33</LLogin>
</Login>
</RECORDS>

Last edited by Lipsita; November 26th, 2015 at 02:03 PM.. Reason: Change
 
Old November 26th, 2015, 02:48 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Use a standard template that copies everything

Code:
<xsl:template match="*">
  <xsl:copy>
    <xsl:copy-of select="@*"/>
    <xsl:apply-templates/>
  </xsl:copy>
</xsl:template>
and then add a template rule that drops the first Login element:

Code:
<xsl:template match="Login[1]"/>
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
XSLT remove node from XML Alex123 XSLT 5 September 18th, 2013 11:13 AM
issue traversing from 3 level down to 3 level up in xml eruditionist XSLT 3 September 22nd, 2010 01:32 PM
to remove namespace prefix form input xml using xslt robin_stringss XSLT 4 May 17th, 2009 06:50 AM
XSLT Going up a level from current node. lafilip XSLT 4 February 23rd, 2007 03:06 PM
To remove a XML node in VB.Net jkusmanto XML 4 May 23rd, 2006 09:18 AM





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