Opened 6 weeks ago
Last modified 5 weeks ago
#65593 new enhancement
Sitemaps: Remove the XSL stylesheet
| Reported by: | masteradhoc | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Sitemaps | Version: | |
| Severity: | normal | Keywords: | has-patch has-unit-tests |
| Cc: | Focuses: |
Description
WordPress currently ships an XSL stylesheet (WP_Sitemaps_Stylesheet) that browsers use to render a human-readable HTML view of the generated sitemap XML, referenced via a <?xml-stylesheet type="text/xsl" href="..." ?> processing instruction in wp-sitemap.xml and each sub-sitemap, pointing at /wp-sitemap.xsl or /wp-sitemap-index.xsl.
Browser support for client-side XSLT is being deprecated and removed. Chrome has announced its removal: https://developer.chrome.com/docs/web-platform/deprecating-xslt. Other browser vendors are following the same path. Once XSLT support is gone, the stylesheet reference becomes dead weight — visitors will just see raw/unstyled XML (or a broken experience) instead of the styled fallback.
Proposed change: remove the XSL stylesheet feature from core entirely, since it will no longer function as intended in modern browsers:
Change History (9)
This ticket was mentioned in PR #12448 on WordPress/wordpress-develop by @masteradhoc.
6 weeks ago
#1
- Keywords has-patch has-unit-tests added
#2
@
6 weeks ago
Ticket originated in the comment from weston here: https://core.trac.wordpress.org/ticket/51543#comment:11
@masteradhoc commented on PR #12448:
6 weeks ago
#3
@westonruter
This PR removes the XSLT-based sitemap stylesheet entirely. That aligns with Chrome's XSLT deprecation (https://developer.chrome.com/docs/web-platform/deprecating-xslt).
But: per Chrome's own docs, type="text/css" continues to be supported (see "XML + CSS is not being removed"). So there's an open question for core: do we want to keep some human-readable sitemap styling via a CSS-based <?xml-stylesheet type="text/css" ...?>, or is dropping styling altogether the intended outcome here?
@westonruter commented on PR #12448:
6 weeks ago
#4
Good question. Is CSS able to style the XML sufficiently?
@masteradhoc commented on PR #12448:
6 weeks ago
#5
@westonruter worth a try IMO. I'd though suggest we'll split it so we can first get rid of the existing implementation and then see if and what we want to style it moving forward.
#7
@
5 weeks ago
I think core should still provide an HTML rendering of the XML Sitemaps.
I've been working on a patch that will allow users to load /wp-sitemap.html in the browser and get the current HTML rendering of their sitemap, by applying the existing XSLT stylesheet server-side. Of course, /wp-sitemap.xml will continue to provide the raw XML sitemap. At this point I'd say the patch is little more than a "proof-of-concept" and not yet ready to even post here.
Before continuing to work on that patch I wanted to start discussion of this issue and see if others think it is worth putting more time into.
@pbiron commented on PR #12448:
5 weeks ago
#8
Good question. Is CSS able to style the XML sufficiently?
It's possible to style the XML with CSS, but it's not possible to make the "links" actually work. However, Chrome & Firefox (and other browsers, AFAIK) don't support XLink in generic XML documents (they do in SVG and MathML)...so it wouldn't be possible for a user to click on a link in the sitemap index to get to load a specific sitemap, nor to click on a link in a specific sitemap to get to that URL on the site.
This ticket was mentioned in PR #12584 on WordPress/wordpress-develop by @pbiron.
5 weeks ago
#9
In addition to removing xml-stylesheet PI to render the sitemap or index into HTML client-side, this PR adds the ability the render the HTML version of the sitemaps and sitemap indices server-side when a user uses the '.html' extension on any sitemap or sitemap index URL.
In it's current form, this PR does not yet address any necessary changes to unit tests.
Trac ticket: https://core.trac.wordpress.org/ticket/65593
## Use of AI Tools
No AI Tools used
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Removes the sitemap XSL stylesheet feature from core. Chrome and other browsers are deprecating and removing XSLT support (https://developer.chrome.com/docs/web-platform/deprecating-xslt), so the
<?xml-stylesheet?>processing instruction pointing at/wp-sitemap.xsl//wp-sitemap-index.xslwill stop working for site visitors and no longer serves its purpose.After this change,
/wp-sitemap.xsland/wp-sitemap-index.xsl404, and generated sitemap XML no longer includes a stylesheet processing instruction.Trac ticket: https://core.trac.wordpress.org/ticket/65593
## Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Sonnet 5
Used for: Implementing the removal across
WP_Sitemaps,WP_Sitemaps_Renderer,canonical.php, andwp-settings.php, deleting the obsoleteWP_Sitemaps_Stylesheetclass, and updating/removing the associated PHPUnit tests. All changes were reviewed and tested by me.