Last active
January 4, 2016 05:39
-
-
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…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 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