Skip to content

Instantly share code, notes, and snippets.

@xpathr
xpathr / utility.xsl
Created May 10, 2012 14:40
HTML Truncate Advanced by buzzomatic
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:str="http://exslt.org/strings">
<!--
A tolerant truncation utility
-->
<xsl:template name="truncate">
<xsl:param name="node" />
<xsl:param name="limit" />
<!--
@xpathr
xpathr / utility.xsl
Created May 10, 2012 14:40
HTML5 Master Stylesheet by dougoftheabaci
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="../utilities/page-title.xsl"/>
<xsl:import href="../utilities/navigation.xsl"/>
<xsl:import href="../utilities/date-time.xsl"/>
<xsl:output method="html" omit-xml-declaration="yes" indent="no" />
<xsl:variable name="is-logged-in" select="/data/events/login-info/@logged-in"/>
@xpathr
xpathr / utility.xsl
Created May 10, 2012 14:40
HTML5 Master Stylesheet (XHTML syntax with indenting) by DavidOliver
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" omit-xml-declaration="yes" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xsl:comment><![CDATA[[if IE 6]><html lang="en" class="no-js ie6 lte-ie9 lte-ie8 lte-ie7 lte-ie6 gte-ie6"><![endif]]]></xsl:comment>
<xsl:comment><![CDATA[[if IE 7]><html lang="en" class="no-js ie7 lte-ie9 lte-ie8 lte-ie7 gte-ie7 gte-ie6"><![endif]]]></xsl:comment>
<xsl:comment><![CDATA[[if IE 8]><html lang="en" class="no-js ie8 lte-ie9 lte-ie8 gte-ie8 gte-ie7 gte-ie6"><![endif]]]></xsl:comment>
<xsl:comment><![CDATA[[if IE 9]><html lang="en" class="no-js ie9 lte-ie9 gte-ie9 gte-ie8 gte-ie7 gte-ie6"><![endif]]]></xsl:comment>
@xpathr
xpathr / utility.xsl
Created May 10, 2012 14:40
IE 6 No More by phoque
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="ie6nomore">
<xsl:comment><![CDATA[[if lt IE 7]> <div style="border: 1px solid #F7941D; background: #FEEFDA; text-align: center; clear: both; height: 75px; position: relative;"> <div style="position: absolute; right: 3px; top: 3px; font-family: courier new; font-weight: bold;"><a href="#" onclick="javascript:this.parentNode.parentNode.style.display='none'; return false;"><img src="http://www.ie6nomore.com/files/theme/ie6nomore-cornerx.jpg" style="border: none; margin: 0px;" alt="Close this notice"/></a></div> <div style="width: 640px; margin: 0 auto; text-align: left; padding: 0; overflow: hidden; color: black;"> <div style="width: 75px; float: left;"><img src="http://www.ie6nomore.com/files/theme/ie6nomore-warning.jpg" alt="Warning!" style="border: none; margin: 0px;" /></div> <div style="width: 275px; float: left; font-family: Arial, sans-serif;">
@xpathr
xpathr / utility.xsl
Created May 10, 2012 14:40
IE Conditional Comments in XSLT by MrBlank
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--
Name: IE Conditional Comments in XSLT
Version: 1.0
Author: Josh Nichols <[email protected]>
URL: http://www.joshnichols.com/
Source: Credit goes to Nick Fitzsimons: http://www.nickfitz.co.uk/2005/10/27/ie-conditional-comments-in-xslt-10/
Description:
@xpathr
xpathr / utility.xsl
Created May 10, 2012 14:40
Image Formatter by wtdtan
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--
BEGIN: optional
if this is already included in another template, this block can be removed
-->
<xsl:template match="body//*">
<xsl:element name="{name()}">
<xsl:apply-templates select="* | @* | text()"/>
</xsl:element>
@xpathr
xpathr / utility.xsl
Created May 10, 2012 14:40
Implode by buzzomatic
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="implode">
<xsl:param name="items" />
<xsl:param name="separator" select="', '" />
<xsl:for-each select="$items">
<xsl:if test="position() &gt; 1">
<xsl:value-of select="$separator" />
</xsl:if>
@xpathr
xpathr / utility.xsl
Created May 10, 2012 14:40
Format Date/Time Advanced by buzzomatic
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" extension-element-prefixes="date">
<!--
Description:
This is a date formatting utility. The named template "format-date" takes 2 parameters:
1. date - [required] takes an ISO date (2005-12-01)
2. format - [optional] takes a format string.
@xpathr
xpathr / utility.xsl
Created May 10, 2012 14:40
Format Duration by rainerborene
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--
Note: Value paramater must be in seconds.
-->
<xsl:template name="format-duration">
<xsl:param name="value" />
@xpathr
xpathr / utility.xsl
Created May 10, 2012 14:40
Format relative URLs by sirlancelot
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Default HTML Manipulation. Do not change these -->
<xsl:template match="*" mode="html">
<xsl:element name="{name()}">
<xsl:apply-templates select="* | @* | text()" mode="html"/>
</xsl:element>
</xsl:template>
<xsl:template match="@*" mode="html">