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 1051033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:51:55+00:00 2026-05-16T16:51:55+00:00

I would like a brief and easy way to strip tags from an XHTML

  • 0

I would like a brief and easy way to strip tags from an XHTML document, and believe there has to be something curt enough among all the options like: XSLT, XPath, XQuery, custom C# programming using the .NET XML namespace. I’m open to others.

For example, I want to strip all <b> tags from an XHTML document but
keep their inner content and child tags
(i.e. not simply skip the bold tag and
its children).

I need to maintain the structure of the original document minus the stripped tags.

Thoughts:

  • I’ve seen XSLT‘s ability to match elements for selection; however I want to match everything by default with a couple of exceptions, and I’m unsure it’s conducive to this. This is what I’m looking at right now.

  • XQuery I haven’t started to look into. (Update for XQuery: Took a brief look at this technology and it’s comparable enough to SQL in function that I fail to see how it can maintain the nested node structure of the original document – I think this is not a contender).

  • A custom C#/.NET XML namespace program might be viable as I already have an idea for it, but my immediate assumption is it’s likely more involved contrasted with the reasons for which these other XML-specific matching languages were created.

  • … another kind of enabling technology I haven’t yet considered…

  • 1 1 Answer
  • 1 View
  • 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-05-16T16:51:56+00:00Added an answer on May 16, 2026 at 4:51 pm

    I need to maintain the structure of
    the original document minus the
    stripped tags

    Have you thought of XSLT? This is the language specifically designed for transforming XML and generally tree structures.

    This transformation:

    <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
     <xsl:strip-space elements="*"/>
    
     <xsl:template match="node()|@*">
      <xsl:copy>
       <xsl:apply-templates select="node()|@*"/>
      </xsl:copy>
     </xsl:template>
    
     <xsl:template match="b">
      <xsl:apply-templates/>
     </xsl:template>
    </xsl:stylesheet>
    

    when applied on any XHTML document, as the one below:

    <html>
     <head/>
     <body>
      <p> Hello, <b>World</b>!</p>
     </body>
    </html>
    

    produces the wanted, correct result, in this case:

    <html>
       <head/>
       <body>
          <p> Hello, World!</p>
       </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to know, if there's a way to play a media-file in
Would like to parse IPv4 address from exit-addresses . Format of the file: ExitNode
Brief: I have a GWT TextBox and CellList. I would like the up/down keys
I would like to have a small brief calendar in wicket. DatePicker is a
I hope you can help! In brief, what I need is something like a
Basically, I would like a brief explanation of how I can access a SQL
I am currently switching languages from Java(beginner) to c++ and would like to replicate
I would like to do something like: find . -type f -exec test $(file
Would like a for loop in jquery so that: For every hover_link: show hidden
Would like someone to take a look at my script and tell me where

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.