This question has been answered by multiple community members. See the first response.
file_get_contents(’url_to_resource’)
$output .= $this->getChunk(
$rowTpl,
array(
'url' => $this->modx->makeUrl($resource->get('id'), '', '', 'full'),
'lastmod' => date('c', $lastmod),
'changefreq' => (!empty($properties['changefreq']) ? $properties['changefreq'] : $this->defaults['changefreq']),
'priority' => (!empty($properties['priority']) ? $properties['priority'] : $this->defaults['priority']),
'pagetitle' => $resource->get('pagetitle'),
'id' => $resource->get('id'),
'createdby' => $resource->get('createdby')
)
);
[[!StercSeoSiteMap? &outerTpl=`SitemapWrapper` &rowTpl=`SitemapRow`]]
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="title">
<xs:restriction base="xs:string" />
</xs:simpleType>
<xs:simpleType name="description">
<xs:restriction base="xs:string" />
</xs:simpleType>
<xs:simpleType name="author">
<xs:restriction base="xs:string" />
</xs:simpleType>
<xs:simpleType name="authorUrl">
<xs:restriction base="xs:string" />
</xs:simpleType>
</xs:schema>
<?xml version="1.0" encoding="[[++modx_charset]]"?>
<?xml-stylesheet type="text/xsl" href="[[~86? &scheme=`full`]]"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:fakesite="[[~89? &scheme=`full`]]"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd
[[~89? &scheme=`full`]]
[[~90? &scheme=`full`]]">
[[+wrapper]]</urlset>
<url>
<loc>[[+url]]</loc>
<lastmod>[[+lastmod]]</lastmod>
<changefreq>[[+changefreq]]</changefreq>
<priority>[[+priority]]</priority>
<fakesite:title>[[+pagetitle]]</fakesite:title>
<fakesite:author>[[+createdby:userinfo=`fullname`]]</fakesite:author>
</url>
<?xml version="1.0" encoding="UTF-8"?>
<!-- xml entities are not as defined as html entities. Define a few missing -->
<!DOCTYPE transform [
<!ENTITY nbsp "& #x000A0;">
<!ENTITY ndash "& #x02013;">
<!ENTITY mdash "& #x02014;">
<!ENTITY copy "& #x000A9;">
<!ENTITY hellip "& #x2026;">
]>
<xsl:stylesheet version="1.0"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:fakesite="[[~89? &scheme=`full`]]"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" doctype-system="about:legacy-compat"/>
<xsl:template match="/">
[[-
Fetch the fully parsed content of a resource only having content <xsl:apply-templates></xsl:apply-templates>
Alias it sitemap and let it's content type be HTML
]]
[[!MakeXSLT? &resourceid=`91`]]
</xsl:template>
<xsl:template match="sitemap:urlset">
<h3>XML Sitemap</h3>
<table cellpadding="5">
<tr style="border-bottom:1px black solid;">
<th>Title</th>
<th>Priority</th>
<th>Change frequency</th>
<th>Last modified (GMT)</th>
</tr>
<xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyzåäö'"/>
<xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ'"/>
<xsl:for-each select="./sitemap:url">
<tr>
<xsl:if test="position() mod 2 != 1">
<xsl:attribute name="class">high</xsl:attribute>
</xsl:if>
<td>
<xsl:variable name="itemURL">
<xsl:value-of select="sitemap:loc"/>
</xsl:variable>
<xsl:variable name="itemTitle">
<xsl:value-of select="fakesite:title"/>
</xsl:variable>
<a href="{$itemURL}">
<xsl:value-of select="fakesite:title"/>
</a>
</td>
<td>
<xsl:value-of select="concat(sitemap:priority*100,'%')"/>
</td>
<td>
<xsl:value-of select="concat(translate(substring(sitemap:changefreq, 1, 1),concat($lower, $upper),concat($upper, $lower)),substring(sitemap:changefreq, 2))"/>
</td>
<td>
<xsl:value-of select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)))"/>
</td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
<xsl:template match="sitemap:sitemapindex">
<h3>XML Sitemap Index</h3>
<table cellpadding="5">
<tr style="border-bottom:1px black solid;">
<th>URL of sub-sitemap</th>
<th>Last modified (GMT)</th>
</tr>
<xsl:for-each select="./sitemap:sitemap">
<tr>
<xsl:if test="position() mod 2 != 1">
<xsl:attribute name="class">high</xsl:attribute>
</xsl:if>
<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="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)))"/>
</td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
<xsl:apply-templates></xsl:apply-templates>Alias it sitemap (our third), and let the content type be HTML.
<?php
$currentResource = $modx->resource;
$currentResourceIdentifier = $modx->resourceIdentifier;
$currentElementCache = $modx->elementCache;
$resource = $modx->getObject('modResource', $resourceid);
$modx->getParser();
$maxIterations = intval($modx->getOption('parser_max_iterations', null, 10));
$modx->resource =& $resource;
$modx->elementCache = array();
$resourceOutput = $modx->resource->process();
$modx->parser->processElementTags('', $resourceOutput, true, false, '[[', ']]', array(), $maxIterations);
$modx->parser->processElementTags('', $resourceOutput, true, true, '[[', ']]', array(), $maxIterations);
$modx->elementCache = $currentElementCache;
$modx->resourceIdentifier = $currentResourceIdentifier;
$modx->resource = $currentResource;
// DOCTYPE must vanish
$resourceOutput = str_replace("<!DOCTYPE html>", "", $resourceOutput);
return $resourceOutput;