Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
<!-- layout.xslt QuickerForm Created by Matthieu Lalonde on 2007-05-29. Copyright 2007 Matthieu Lalonde. All rights reserved. --> <xsl:stylesheet version="1.0" xml:lang="en" xmlns:exsl="http://exslt.org/common" xmlns:exfunc="http://exslt.org/functions" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fn="http://www.w3.org/2005/02/xpath-functions" xmlns:php="http://php.net/xsl" xsl:extension-element-prefixes="exsl exfunc fn"> <!-- Importing external stylesheets --> <xsl:import href="./head.xslt" /> <xsl:import href="./forms.xslt" /> <xsl:output media-type="application/xhtml+xml" method="html" indent="yes" omit-xml-declaration="yes" doctype-public="-//W3C//DTD XHTML 1.1//EN" doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" encoding="UTF-8" /> <!-- Defining page parameters --> <xsl:param name="printXML" /> <xsl:param name="baseURI" select="/appData/appConfig/baseURI" /> <xsl:param name="pageUID" select="/appData/appConfig/queryString/page_uid" /> <xsl:param name="startYear" select="2007"/> <xsl:template match="/"> <html> <head> <xsl:call-template name="head"/> </head> <body> <xsl:call-template name="header" /> <xsl:call-template name="menu" /> <xsl:comment>Page content start</xsl:comment> <div id="bodyContainer"> <xsl:choose> <xsl:when test="/appData/pageList/pageData[@uid = $pageUID]/name = '404'"> <xsl:call-template name="pageNotFound" /> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="/appData/pageData[@uid = $pageUID]" /> </xsl:otherwise> </xsl:choose> <div class="clear"><xsl:comment>Not Empty</xsl:comment></div> </div> <xsl:comment>Page content end</xsl:comment> <xsl:call-template name="footer" /> </body> </html> </xsl:template> <xsl:template name="header"> <xsl:comment>Header start</xsl:comment> <div id="headerContainer"> <xsl:if test="/appData/pageList/pageData[@uid = $pageUID]/pageTitle"> <h1> <xsl:value-of select="/appData/pageList/pageData[@uid = $pageUID]/pageTitle" /> </h1> </xsl:if> <div class="clear"><xsl:comment>Not Empty</xsl:comment></div> </div> <xsl:comment>Header end</xsl:comment> </xsl:template> <!-- /** MENU **/ This matches the menu items and parses them into a menu DOM --> <xsl:template name="menu"> <xsl:comment>Menu start</xsl:comment> <div id="menuContainer"> <xsl:apply-templates select="/appData/pageList"> <xsl:sort select="@id" data-type="number" order="ascending" /> </xsl:apply-templates> <div class="clear"><xsl:comment>Not Empty</xsl:comment></div> </div> <xsl:comment>Menu end</xsl:comment> </xsl:template> <xsl:template match="/appData/pageList"> <ol> <xsl:apply-templates select="pageData[(not(parent) or parent = '') and name != '404']"> <xsl:sort select="pageData[(not(parent) or parent = '') and name != '404']|@uid" data-type="number" order="ascending" /> </xsl:apply-templates> </ol> </xsl:template> <xsl:template match="pageList/pageData"> <xsl:variable name="pageItem" select="@uid" /> <li> <a> <xsl:attribute name="title"><xsl:value-of select="title" /></xsl:attribute> <xsl:attribute name="href"> <xsl:if test="not($baseURI = '' or not($baseURI) or $baseURI = '/')"> <xsl:value-of select="$baseURI" /></xsl:if><xsl:if test="substring(uri, 1, 1) = '/'"><xsl:value-of select="substring(uri, 2)" /></xsl:if> </xsl:attribute> <xsl:if test="($pageUID = $pageItem) or count(../pageData[@uid = $pageUID and parent = $pageItem])"> <xsl:attribute name="class">menu_current</xsl:attribute> </xsl:if> <xsl:value-of select="title" /> </a> <!-- Check for children pages --> <xsl:if test="count(../pageData[parent = $pageItem]) > 0"> <ol> <xsl:apply-templates select="../pageData[parent = $pageItem]"> <xsl:sort select="../pageData[parent = $pageItem]|@uid" data-type="number" order="ascending" /> </xsl:apply-templates> </ol> </xsl:if> </li> </xsl:template> <!-- /** END MENU **/ --> <xsl:template name="footer"> <xsl:comment>Footer start</xsl:comment> <div id="footerContainer"> <p> Copyright © <xsl:value-of select="$startYear" /> <xsl:if test="$currentYear > $startYear"> -<xsl:value-of select="$currentYear" /> </xsl:if> Smurfturf.net </p> <div class="clear"><xsl:comment>Not Empty</xsl:comment></div> <xsl:if test="$printXML = 'true'"> <textarea cols="160" rows="200" style="width: 100%; height:600px"> <xsl:copy-of select="/"/> </textarea> </xsl:if> </div> <xsl:comment>Footer end</xsl:comment> <script type="text/javascript"> AppController.init(); <xsl:call-template name="additionalJavascriptLoader" /> </script> </xsl:template> <xsl:template match="appData/pageData[@uid = $pageUID]"> <xsl:if test="not(not(content) or content = '')"> <xsl:apply-templates match="content" /> </xsl:if> <!-- <p> <xsl:value-of select="php:function('getStr', 'i_am', 'common')" /> [<xsl:value-of select="//pageList/pageData[@uid = $pageUID]/name" />] page: <br /> <xsl:if test="not(not(content) or content = '')"> <xsl:apply-templates match="content" /> </xsl:if> </p> --> </xsl:template> <xsl:template match="content"> <xsl:value-of select="." /> </xsl:template> <xsl:template name="pageNotFound"> <p> <h2>This page (<xsl:value-of select="/appData/appConfig/queryString/request_uri" />) does not exist!</h2> </p> </xsl:template> <xsl:template match="userInfo"> <!-- This stores the session information and should *never* be displayed --> </xsl:template> <!-- These can be overwritten by stylesheets to add CSS/JS calls --> <xsl:template name="additionalJavascript"></xsl:template> <xsl:template name="additionalJavascriptLoader"></xsl:template> <xsl:template name="additionalStyleSheet"></xsl:template> <!-- This allows raw html to be added to the content --> <xsl:template match="rawHTML"> <xsl:copy-of select="."/> </xsl:template> <!-- Don't show what isn't use, and if you need, match attributes! --> <xsl:template match="node()|@*"></xsl:template> <!-- <xsl:variable name="stuff"> <item id="0">one</item> <item id="1">two</item> <item id="2">three</item> </xsl:variable> <xsl:variable name="theStuff" select="exsl:node-set($stuff)"/> <xsl:value-of select="$theStuff/item[@id = 1]" /> --> </xsl:stylesheet>
This paste will be private.
From the Design Piracy series on my blog: