Skip to content

Instantly share code, notes, and snippets.

View greystate's full-sized avatar
:octocat:
Octocatering

Chriztian Steinmeier greystate

:octocat:
Octocatering
View GitHub Profile
@greystate
greystate / currency-symbols.xslt
Created March 10, 2011 01:01
Mapping currency codes to currency symbols
<xsl:variable name="currency-mapper">
<currency code="USD">$</currency>
<currency code="EUR"><![CDATA[&euro;]]></currency>
<currency code="YEN"><![CDATA[&yen;]]></currency>
<currency code="GBP"><![CDATA[&pound;]]></currency>
</xsl:variable>
<xsl:variable name="currency-symbols" select="msxml:node-set($currency-mapper)" />
<xsl:template match="@currency" mode="symbol">
<xsl:variable name="symbol" select="$currency-symbols/currency[@code = current()]" />
@greystate
greystate / context-node-in-umbraco-macros.xslt
Created March 15, 2011 22:35
An attempt to explain when "/root" will work inside an Umbraco macro
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:umb="urn:umbraco.library"
exclude-result-prefixes="umb"
>
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />
<xsl:variable name="xml">
<nodes>
<xsl:for-each select="$currentPage/../*[@isDoc]">
<xsl:sort select="contentDate" data-type="text" order="descending" />
<node header="{contentHeader}">
<xsl:value-of select="@id" />
</node>
</xsl:for-each>
</nodes>
</xsl:variable>
@greystate
greystate / multipicker-01.html
Last active September 25, 2015 10:18
Code listings for "Using the Multi-Node Tree Picker in XSLT" (Pimp My XSLT article)
<!-- Link -->
<p class="goodness">
<a href="http://4815162342x.com/numbers" title="This is very mysterious…">
Today’s Mystery Link — Make sure you’re ready!
</a>
</p>
<!-- Video -->
<video class="sublime" width="400" height="300" poster="pimpcast.png" preload="none">
<source src="TextMate-XSLT.mp4" />
@greystate
greystate / match-templates-intro-01.xslt
Created April 15, 2011 23:09
Code listings (new XML Schema) for "An intro to using match templates in Umbraco" (Pimp My XSLT article)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="msxml umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes"/>
@greystate
greystate / match-templates-intro-01_legacy.xslt
Created April 15, 2011 23:15
Code listings (legacy XML Schema) for "An intro to using match templates in Umbraco" (Pimp My XSLT article)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="msxml umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes"/>
@greystate
greystate / dictionary-items-01.xslt
Created April 23, 2011 20:39
Code listings for "Using Dictionary Items in XSLT" (Pimp My XSLT article)
<xsl:template match="/">
<h2><xsl:value-of select="umbraco.library:GetDictionaryItem('SearchTitle')" /></h2>
<!-- do stuff -->
</xsl:template>
@greystate
greystate / include-or-import-01.xslt
Created April 23, 2011 20:52
Code listings for "xsl:include or xsl:import?" (Pimp My XSLT article)
<xsl:stylesheet ... >
<!-- All media goes through here -->
<xsl:template match="*" mode="media">
<xsl:variable name="mediaNode" select="umbraco.library:GetMedia(., false())" />
<xsl:apply-templates select="$mediaNode[not(error)]" mode="media" />
</xsl:template>
<!-- Image file -->
<xsl:template match="Image" mode="media">
@greystate
greystate / snippet-template.xslt
Created April 28, 2011 19:15
Code listings for some Behind The Scenes info
<xsl:template match="snippet//@*[name() = substring-after(../@hi:lite, '@')]">
<xsl:text> </xsl:text>
<span class="hilite attr">
<xsl:value-of select="concat(name(), '=&quot;', ., '&quot;')" />
</span>
</xsl:template>
@greystate
greystate / TagCloud.xslt
Created May 20, 2011 21:11
Refactoring of http://snipt.org/xKr (included below)
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:umb="urn:umbraco.library"
xmlns:make="urn:schemas-microsoft-com:xslt"
xmlns:math="urn:Exslt.ExsltMath"
exclude-result-prefixes="umb math make"
>