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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:51:46+00:00 2026-05-30T02:51:46+00:00

We are migrating from one content system into another and have tons of HTML

  • 0

We are migrating from one content system into another and have tons of HTML where there are lines, for example, like this:

<p style="text-align: justify;"><i> </i></p>

I am looking for a way to strip HTML with Python where there is no text output to the screen. So a line similar to this would be stripped.

And, this is just one of MANY examples of lines where there is no text output. So, I would need to find them all to strip. I don’t have to worry about images, movies, etc. since only text was possible in our old content management system.

BTW, the vast majority of the lines either start with a p tag or a div tag (ignoring leading whitespace).

  • 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-05-30T02:51:48+00:00Added an answer on May 30, 2026 at 2:51 am

    In case the HTML is also a well-formed XML document (This can be done in a pre-pass with a tool like HTML-Tidy), this transformation:

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

    when applied on any such XML document — for example:

    <html>
     <body>
       Welcome.
       <p style="text-align: justify;"><i> </i></p>
     </body>
    </html>
    

    produces the wanted result in which any element whose string value is empty or is all whitespace, is deleted:

    <html>
    
       <body>
          Welcome.
    
    
       </body>
    
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Are there tools for migrating from one virtual machine type to another? E.g let's
Does anyone have any experience migrating from one DBMS to another? If you have
I am migrating from one system to another and in the process, I will
I m migrating my existing drupal site from one server to another . I
I am migrating data from one model version to another in the iPhone, but
we are migrating from WebLogic web-services to Spring-WS (1.5.X). There is currently one issue
I am migrating a mysql database from one site to another. Its encodign: utf8
I have been migrating from subversion to mercurial piecemeal and this has created a
I'm migrating SQL from one platform to another. The SQL contains DECODE statements, which
Hi can any one suggest tool for migrating from TFS to TFS preferred Open

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.