Skip to content

Instantly share code, notes, and snippets.

@greystate
Last active January 4, 2016 05:39
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save greystate/8576730 to your computer and use it in GitHub Desktop.
Save greystate/8576730 to your computer and use it in GitHub Desktop.
How to output nodes from a CSV list of ids in a property (Umbraco) - it silently handles duplicates and non-existing (unpublished or trashed) nodes by grabbing a nodeset of all the nodes that have an id that's contained in the CSV list. Using the [<apply-templates />](http://pimpmyxslt.com/reference/#apply-templates) instruction makes it easy to…
<!-- Umbraco hands us the XML document here -->
<xsl:param name="currentPage" />
<xsl:template match="/">
<!-- This is just to get the right context document -->
<xsl:for-each select="$currentPage">
<!-- Supplying a white-space separated string to `id()` will work! -->
<xsl:apply-templates select="id(translate(propertyName, ',', ' '))" />
</xsl:for-each>
</xsl:template>
<!-- Sample template for output -->
<xsl:template match="*[@isDoc]" priority="-1">
<p><xsl:value-of select="@nodeName" /></p>
</xsl:template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment