Skip to content

Instantly share code, notes, and snippets.

@uniquelau
Last active December 15, 2015 11:58
Show Gist options
  • Save uniquelau/5256385 to your computer and use it in GitHub Desktop.
Save uniquelau/5256385 to your computer and use it in GitHub Desktop.
Snippet of GetTemplate, that loads Umbraco content into an XML based template.
<!-- Process <content /> -->
<xsl:template match="content">
<!-- Process the $currentPage and load it's RTE, etc -->
<xsl:apply-templates select="$currentPage[current()/@position = 1]" mode="content">
<xsl:with-param name="position" select="@position" />
</xsl:apply-templates>
<!-- When the template has more than 1 content block, look inside the /Callouts folder-->
<xsl:if test="@position &gt; 1">
<!-- Handle sub content blocks, these could be RTE's, Link Groups, Widgets, Video's -->
<xsl:apply-templates select="$currentPage/Callouts/* [@isDoc][position() = current()/@position - 1]" mode="content">
<!-- Note we -1 from position, because we are now inside a folder, so we start from 1 again. -->
<xsl:with-param name="position" select="@position" />
</xsl:apply-templates>
</xsl:if>
<xsl:text> </xsl:text>
</xsl:template>
<!-- Template fragements stored as XML inside Umbraco -->
<div class="columnswrap layoutcols2">
<div class="col1">
<content class="innercontent" position = "1" />
</div>
<div class="col2>
<content class="innercontent" position = "2" />
</div>
<aside>
<comments actions="list,create" />
</aside>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment