Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
turbohtml
Logo
turbohtml
  • Tutorials
    • Foundations
      • Getting started
      • Tokenizing a document
      • Parsing a document into a tree
      • Building and editing a tree
      • Exporting to text
    • Real-world
      • Finding what you need
      • Reading messy bytes
      • Pulling content out of a page
      • Working with forms
      • Cleaning and shrinking HTML
      • Transforming without a full tree
      • Doing a one-off job from the shell
  • How-to guides
    • Workflows
      • Turn a web page into Markdown for an LLM
      • Read a page’s head metadata
      • Truncate HTML to a length, keeping tags balanced
    • Parse & DOM
      • Parse HTML into a tree
      • Parse XML into a tree
      • Tokenize HTML
      • Parse with SAX callbacks
      • Parse into your own tree
      • Rewrite HTML without building a tree
      • Edit the tree
      • Inspect a node you already hold
      • Work with ranges of the tree
      • Observe tree mutations
      • Use the Shadow DOM
      • Work with forms
      • Migrate from html.parser.HTMLParser
    • Detect
      • Handle character encodings
    • Query
      • Select elements with a CSS selector
      • Find elements with the find filter
      • Walk a tree with a cursor and filter
      • Match elements the soupsieve way
      • Chain queries like pyquery
      • Trim a document to a selector
      • Query a tree with XPath
      • Extract strings and attributes
      • Resolve an element’s computed style
    • Clean
      • Sanitize untrusted HTML
      • Find and rewrite links
      • Minify HTML and JavaScript
    • Convert & transform
      • Translate a CSS selector to XPath
      • Transform XML with XSLT
    • Extract
      • Extract the main article
      • Read tables into rows and records
      • Extract structured data
      • Read an RSS or Atom feed
    • Build
      • Build HTML with E
    • Serialize
      • Serialize a tree to HTML
      • Canonicalize a tree for c14n
      • Export a tree to Markdown
      • Export a tree to plain text
      • Escape and unescape text
    • Validate
      • Validate against an XML schema
      • Check a document for conformance
    • Getting help
      • Run turbohtml from a shell
      • Troubleshooting
  • Migrating to turbohtml
    • Parse & DOM
      • From BeautifulSoup
      • From lxml
      • From html5lib
      • From selectolax
      • From resiliparse
      • From MechanicalSoup
      • From html5-parser
      • From the standard library
      • From parse5
      • From jsdom
      • From lol-html
    • Detect
      • From charset-normalizer
      • From chardet
    • Query
      • From soupsieve
      • From parsel
      • From pyquery
      • From cssutils
    • Clean
      • From linkify-it-py
      • From bleach
      • From nh3
      • From lxml-html-clean
      • From rcssmin
      • From rjsmin
      • From jsmin
      • From minify-html
      • From htmlmin
      • From csscompressor
      • From html-sanitizer
      • From calmjs.parse
      • From html5validator
      • From lightningcss
      • From sanitize-html
      • From DOMPurify
    • Convert
      • From cssselect
    • Extract
      • From pandas
      • From w3lib
      • From trafilatura
      • From courlan
      • From extruct
      • From justext
      • From readability-lxml
      • From readabilipy
      • From metadata_parser
      • From newspaper3k
      • From boilerpy3
      • From goose3
      • From microdata
      • From news-please
      • From opengraph
      • From htmldate
      • From feedparser
    • Build
      • From dominate
      • From yattag
      • From htbuilder
      • From htpy
      • From airium
      • From markyp
      • From fast-html
      • From simple-html
      • From hyperpython
    • Serialize
      • From markupsafe
      • From markdownify
      • From html2text
      • From inscriptis
      • From html-text
  • Reference
    • Parsing
    • Nodes
    • Tokenizer
    • Detect
    • Query
    • CSSOM
    • Clean
    • Convert
    • Transform
    • Extract
    • Structured data
    • Build
    • Serialize
    • Validation
    • Conformance
    • Command line
  • Explanation
    • Foundations
      • Why a C core
      • Matching the standard library
      • Free-threading
    • Parse & DOM
      • Parsing: from bytes to a navigable tree
      • The strict XML parsing mode
      • The event-driven parse
      • Retargeting the parser
      • The streaming rewrite model
      • Source locations
      • The node and tree model
      • Traversal objects
      • Ranges and boundary points
      • Shadow DOM
      • Mutating the tree
    • Encoding detection
    • Query
      • Querying the tree
      • The cascade and computed style
    • Layered sanitizing
    • XSLT
    • Extract
      • Structured-data extraction
      • Finding the main content
    • Building a tree
    • Serialize
      • Serialization and export
      • Canonical XML (c14n)
    • Validate
      • Validation
      • Conformance
  • Development
    • Performance
  • How turbohtml was built
  • Changelog
  • License
Back to top
View this page

Convert¶

Move selector translation to turbohtml.

  • From cssselect
Next
From cssselect
Previous
From DOMPurify
Copyright © 2026, Bernát Gábor and contributors
Made with Sphinx and @pradyunsg's Furo
Last updated on Jul 08, 2026