• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Jetpack a2z

Jetpack a2z

Jetpack a2z

  • Home
  • Plugins
  • Blocks
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / Jetpack_Sitemap_Stylist::sitemap_xsl() – Returns the xsl of a sitemap xml file as a string.

You appear to be a bot. Output may be restricted

Description

Returns the xsl of a sitemap xml file as a string.

Usage

$string = Jetpack_Sitemap_Stylist::sitemap_xsl();

Parameters

Returns

string The contents of the xsl file.

Source

File name: jetpack/modules/sitemaps/sitemap-stylist.php


Lines:

1 to 100 of 104
  public static function sitemap_xsl() {
    $title          = esc_html( ent2ncr( __( 'XML Sitemap', 'jetpack' ) ) );
    $header_url     = esc_html( ent2ncr( __( 'URL', 'jetpack' ) ) );
    $header_lastmod = esc_html( ent2ncr( __( 'Last Modified', 'jetpack' ) ) );

    $description = self::sanitize_with_links(
      __(
        'This is an XML Sitemap generated by <a href="%1$s" rel="noopener noreferrer" target="_blank">Jetpack</a>, meant to be consumed by search engines like <a href="%2$s" rel="noopener noreferrer" target="_blank">Google</a> or <a href="%3$s" rel="noopener noreferrer" target="_blank">Bing</a>.',
        'jetpack'
      ),
      array(
        1 => 'https://jetpack.com/',
        2 => 'https://www.google.com/',
        3 => 'https://www.bing.com/',
      )
    );

    $more_info = self::sanitize_with_links(
      __(
        'You can find more information on XML sitemaps at <a href="%1$s" rel="noopener noreferrer" target="_blank">sitemaps.org</a>',
        'jetpack'
      ),
      array(
        1 => 'https://sitemaps.org',
      )
    );

    $generated_by = self::sanitize_with_links(
      __(
        'Generated by <a href="%s" rel="noopener noreferrer" target="_blank">Jetpack for WordPress</a>',
        'jetpack'
      ),
      array(
        1 => 'https://jetpack.com',
      )
    );

    $css = self::sitemap_xsl_css();

    return <<<XSL
<?xml version='1.0' encoding='UTF-8'?>
<xsl:stylesheet version='2.0'
	xmlns:html='http://www.w3.org/TR/REC-html40'
	xmlns:sitemap='http://www.sitemaps.org/schemas/sitemap/0.9'
	xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:output method='html' version='1.0' encoding='UTF-8' indent='yes'/>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>$title</title>
	<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
	<style type='text/css'>
$css
	</style>
</head>
<body>
	<div id='description'>
		<h1>$title</h1>
		<p>$description</p>
		<p>$more_info</p>
	</div>
	<div id='content'>
		<!-- <xsl:value-of select="count(sitemap:urlset/sitemap:url)"/> -->
		<table>
			<tr>
				<th>#</th>
				<th>$header_url</th>
				<th>$header_lastmod</th>
			</tr>
			<xsl:for-each select="sitemap:urlset/sitemap:url">
				<tr>
					<xsl:choose>
						<xsl:when test='position() mod 2 != 1'>
							<xsl:attribute name="class">odd</xsl:attribute>
						</xsl:when>
					</xsl:choose>
					<td>
						<xsl:value-of select = "position()" />
					</td>
					<td>
						<xsl:variable name='itemURL'>
							<xsl:value-of select='sitemap:loc'/>
						</xsl:variable>
						<a href='{\$itemURL}'>
							<xsl:value-of select='sitemap:loc'/>
						</a>
					</td>
					<td>
						<xsl:value-of select='sitemap:lastmod'/>
					</td>
				</tr>
			</xsl:for-each>
		</table>
	</div>
	<div id='footer'>
		<p>$generated_by</p>
	</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>\n
[1] [2] Next »

 View on GitHub View on Trac

Share this:

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Pinterest (Opens in new window)

Related

Published: 27 November 2019 | Last updated: 27 November 2019

Primary Sidebar

Information

Function name: Jetpack_Sitemap_Stylist::sitemap_xsl
Class ref: Jetpack_Sitemap_Stylist
Plugin ref: Jetpack
Version: 7.9.1
Sourcefile: modules/sitemaps/sitemap-stylist.php
File ref: modules/sitemaps/sitemap-stylist.php
Deprecated?: No
API Letters: J,S,X

Footer

Jetpack a2z Jetpack a2z
Jetpack a2z
WordPress 5.3.1
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  jetpack.wp-a2z.org
© Copyright Jetpack a2z 2014-2019. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites