Skip to content

Instantly share code, notes, and snippets.

@jessgusclark
Last active March 10, 2017 23:32
Show Gist options
  • Save jessgusclark/891b7ce9c05c1505a4aed5f58fed56ae to your computer and use it in GitHub Desktop.
Save jessgusclark/891b7ce9c05c1505a4aed5f58fed56ae to your computer and use it in GitHub Desktop.
Get All Files with the Tag of the page.
<xsl:template name="GetDataFilesWithTag">
<!-- Get the current file's path -->
<xsl:variable name="current-page"
select="concat('ou:/Tag/GetTags?', 'site=', $ou:site, '&amp;path=', replace($ou:path, '.html', '.pcf')" />
<!-- Get the first Tag that is associated with this subject listing page -->
<xsl:variable name="page-tag" select="doc( $current-page ) )/tags/tag[1]/name" />
<!-- Get Data Files With the Tag -->
<xsl:variable name="tag-select"
select="doc( concat('ou:/Tag/GetFilesWithAnyTags?site=', $ou:site, '&amp;tag=', $page-tag) )" />
<!-- Loop through the pages that contain the keyword: -->
<xsl:for-each select="$tag-select/pages/page">
<!-- Sort the pages by the path -->
<xsl:sort select="path" />
<!-- Pass the path to a new function to handle the next step -->
<xsl:call-template name="GetContentFromSingleDataFile">
<xsl:with-param name="data-url" select="path" />
</xsl:call-template>
</xsl:for-each>
</xsl:template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment