Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9147699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:03:43+00:00 2026-06-17T11:03:43+00:00

I have an xml like <xml> <Text> <body> <para type=new> This para needs to

  • 0

I have an xml like

<xml>
   <Text>
       <body>
       <para type="new"> This para needs to be suppress </para> 
       <para type="old"> This is an old para </para> 
       </body>     
  </Text>    
</xml>

I want to suppress the body/para/@type=’new’ which I can do using following templete

<xsl:template match="para[@type='new']">
</xsl:template>

Having said that, I want to actually add another condition that if body does not contain any other element other then para/@type=’new’ then whole body element should be removed.

So

 <xml>
   <Text>
       <body>
       <para type="new"> This para needs to be suppress </para> 
       </body>     
  </Text>    
</xml>

should return

<xml>
   <Text>
   </Text>    
</xml>

and

<xml>
    <Text>
       <body>
          <para type="new"> This para needs to be suppress </para> 
          <para type="old"> This is an old para </para> 
       </body>     
    </Text>    
</xml>

should return

<xml>
   <Text>
       <body>
       <para type="old"> This is an old para </para> 
       </body>     
  </Text>    
</xml>

Any help or hint how to do that…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T11:03:44+00:00Added an answer on June 17, 2026 at 11:03 am

    How about one more template:

    <xsl:template match="Text[count(body/*) = count(body/para[@type = 'new'])]" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following XML. <body> <p type=Heading 1>My Heading</p> <p>This is paragraph Text...
I have an Xml like this: <root> <item> <content type=HTML> <![CDATA[<html> <head></head> <body>something goes
If I have some xml like this: <mynode> <mysubnode> <mysubsubnode>hello world</mysubsubnode> some more text
I have an XML file which I'd like to parse into a non-XML (text)
I have some XML files of this form: <?xml version=1.0 encoding=utf-8?> <?xml-stylesheet type=text/xsl href=biomirror.xsl?>
I have an XML document like this: <xml> <item> <title>Article 1</title> <text><![CDATA[Lorem ipsum dolor
I have a snippet of XML that looks like <body> Some text.... <nodeA>....</nodeA> more
I have the following xml <smses> <sms address=87654321 type=1 body=Some text readable_date=3/09/2011 2:16:52 PM
I have a XML file with code like <?xml version=1.0 encoding=UTF-8?> <?xml-stylesheet href=rss2.xsl type=text/xsl
I have XML like this: <article> <title>Article 1 title</title> <text>Lorem ipsum...</text> <image>http://example.com/img_01.jpg</image> </article> <article>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.