<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rssdatehelper="urn:rssdatehelper"><channel><title>Umbraco By Squirrels</title><link>http://www.bysquirrels.com</link><pubDate></pubDate><generator>umbraco</generator><description>The Development Squirrels from VooDooDog</description><language>en</language><item><title>localLinks</title><link>http://www.bysquirrels.com/2009/10/20/locallinks.aspx</link><pubDate>Tue, 20 Oct 2009 16:57:16 GMT</pubDate><guid>http://www.bysquirrels.com/2009/10/20/locallinks.aspx</guid><content:encoded><![CDATA[ 
<h3>{localLinks}</h3>

<h4>Overview</h4>

<p>On a recent project we stumbled into an interesting problem. We
had been asked to build a very simple website, however we wanted to
allow the site to grow and develop so making it as flexible as
possible was paramount. The site would have monthly publications
which could contain 'assets'. It was likely the 'assets' would be
used in future publications so we wanted to store these in their
own folder.</p>

<p>The publication would show a preview of the asset &amp; when it
was clicked the asset would play at the top of the publication.
This was done by passing the nodeID of the asset into the
querystring of the publication page. The publication also showed a
teaser which was associated to the asset.</p>

<p>This gave our client a very flexible solution. However our
clients wanted to be able to link to other assets within the teaser
(contentTeaser) field.</p>

<p>This presented us with a problem, the content editor could link
to other assets. But when this link was parsed it would link to the
other document. This was not the behavior we wanted, we wanted to
access the nodeID and pass this in the query string to keep
behavior uniform.</p>

<p>-</p>

<p>To do this we needed to interupt how Umbraco parsed the XML by
Encoding the 'contentTeaser', accessing the link information,
replacing it, and then decoding the data so it would be suitable
for front-end render again.</p>

<p>We did this using XSLT, eXSLT, Regex and some C#.</p>

<h4>References</h4>

<p><a
href="http://our.umbraco.org/wiki/reference/xslt/extend-your-xslt-with-custom-functions"
 title="Our Umbraco is the first stop for Umbraco information. This link contains information on creating a custom XSLT Function">
our.Umbraco.org - Extend your XSLT with Custom Functions</a><br />
 <a
href="http://www.exslt.org/regexp/functions/replace/regexp.replace.html"
 title="the home of eXSLT - information on Regex Replace">eXSLT.org
- Regex Replace</a><br />
 <a href="http://www.exslt.org/regexp/functions/match/index.html"
title="eXSLT - Match Examples">eXSLT.org - Regex Match</a> (more
useful examples)<br />
 <a href="http://our.umbraco.org/wiki/reference/umbracolibrary"
title="Reference on the Umbraco Library functions.">our.Umbraco.org
- Umbraco Library</a></p>

<p>&nbsp;</p>

<h4>The Code</h4>

<p>This document has been broken down into six sections, at the
bottom of this page is a link to download the XSLT.</p>

<ol>
<li>Custom XSLT Function</li>

<li>Get the $currentPage URL</li>

<li>Get the $currentPage Content and Encode (variable)</li>

<li>Set the Regex String Replacement</li>

<li>Run Regex Replace</li>

<li>Get the Replace Output, Decode &amp; Display.</li>
</ol>

<p>&nbsp;</p>

<p>&nbsp;</p>

<p><strong>1. Custom XSLT</strong></p>

<p>This code has been referenced from the Umbraco Wiki you can find
it <a
href="http://our.umbraco.org/wiki/reference/xslt/extend-your-xslt-with-custom-functions"
 title="Umbraco XSLT Extend">here.</a></p>

<p style="padding-left: 30px;">&lt;msxml:script
implements-prefix="htmlDecode" language="C#"&gt;<br />
 &lt;msxml:assembly name="System.Web"/&gt;<br />
 &lt;msxml:using namespace="System.Web"/&gt;<br />
<br />
 &lt;![CDATA[ public string convertText(string text) { string
decodedStr = HttpUtility.HtmlDecode(text); return decodedStr; }
]]&gt;<br />
<br />
 &lt;/msxml:script&gt;</p>

<p>&nbsp;</p>

<p><strong>2. Get the $currentPage URL</strong></p>

<p>We need the URL for the page we want to make the links reference
too.<br />
 Using the 'umbraco.library:NiceURL(string)' function.</p>

<p>This URL is assigned the variable '$niceURL'.</p>

<p style="padding-left: 30px; ">&lt;xsl:variable
name="niceURL"&gt;<br />
 &lt;xsl:value-of
select="umbraco.library:NiceUrl($currentPage/@id)"/&gt;<br />
 &lt;/xsl:variable&gt;</p>

<p><br />
 <strong>3.&nbsp;Get the $currentPage Content and Encode
(variable)</strong></p>

<p>Next we grab the content which contains our links. In this case
the datatype was a richtext editor. To be able to process this with
the eXSLT:Regex extension we needed to encode the characters in the
HTML.</p>

<p>This is really easy to do using the
'umbraco:library:HtmlEncode(string)' function.</p>

<p style="padding-left: 30px;">&lt;xsl:variable
name="assetTeaser"&gt;<br />
 &lt;xsl:value-of select="umbraco.library:HtmlEncode(data [@alias =
'assetTeaser'])"/&gt; &lt;/xsl:variable&gt;</p>

<p><br />
 <strong>4.&nbsp;Set the Regex String Replacemen</strong>t</p>

<p>For some reason I couldn't write the whole replacement string in
the regex replace function. So I pull in the string I wanted by
setting it as a variable. In anyone knows how to fix this please
let me know!</p>

<p style="padding-left: 30px;">&lt;xsl:variable
name="niceURLregex"&gt;<br />
 ..&lt;xsl:value-of select="$niceURL"/&gt;<br />
 ?clip=$1<br />
 &lt;/xsl:variable&gt;</p>

<p><br />
 <strong>5. Run Regex Replace</strong></p>

<p>Using a eXSLT function called replace would can feed in our
content, find the {localLinks} and then replace these with the
variable we set earlier.</p>

<p>in this case, we are looking for localLink and a 4 digit number.
Its worth noting the number could be longer than four digits if
your site has many nodes. We also inform the processor that it is
dealing with a multiline input (m), a ungreedy pattern (U) and to
treat each string as a single line (s); giving us 'mUs'.</p>

<p>We now need to feed the function the replacement information. As
noted above I could not find a way to write what is stored in the
variable directly. Because of this we simply pull the variable
in.</p>

<p>&nbsp;</p>

<p>This string tells is to;</p>

<ul>
<li>.. - move to the root.</li>

<li>$niceURL - get the niceURL variable, defined in the top of the
document. This is just the URL for the current page.</li>

<li>?clip= - add some static text</li>

<li>$1 - add the string, e.g "1234" in /{localLink:(1234)}</li>
</ul>

<p>&lt;xsl:variable name="assetTeaserReplace"&gt;<br />
 &lt;xsl:value-of
select="Exslt.ExsltRegularExpressions:replace($assetTeaser,
'/{localLink:([0-9][0-9][0-9][0-9])}', 'mUs', $niceURLregex )"
disable-output-escaping="no" /&gt; &lt;/xsl:variable&gt;</p>

<p><br />
 <strong>6. Get Replace Output, Decode and Display</strong></p>

<p>Okay so we've taken $assetTeaser, and using some regex we've
updated the links. Now we need to Decode it. (we encoded it to
start with).&nbsp;Its at this point we run the custom function we
set at the top of the document which gives us the capability to
decodeHTML.</p>

<p>&lt;xsl:value-of
select="htmlDecode:convertText(string($assetTeaserReplace))"
disable-output-escaping="yes" /&gt;</p>

<p>-</p>

<p><a href="/xslt/snippetLocalLinks.xslt" title="Download XSLT">You
can download the XSLT for this here.</a></p>
]]></content:encoded></item><item><title>umbTop - Umbraco Desktops</title><link>http://www.bysquirrels.com/2009/8/5/umbtop---umbraco-desktops.aspx</link><pubDate>Wed, 05 Aug 2009 12:19:13 GMT</pubDate><guid>http://www.bysquirrels.com/2009/8/5/umbtop---umbraco-desktops.aspx</guid><content:encoded><![CDATA[ 
<p>To mark the London Umbraco User Conference on August the 6th. We
have created a series of Umbraco backgrounds for your laptops!
:)</p>

<p>Lau</p>

<p><a href="http://umbTop.voodoodog.com/?blog"
title="umbTop, Umbraco Desktops by VooDooDog."><strong>http://umbTop.voodoodog.com/</strong></a></p>

<p><img src="/media/148/small.jpg" width="450" height="360" alt="Umbraco Desktop"/></p>
]]></content:encoded></item><item><title>List based Menu - XSLT</title><link>http://www.bysquirrels.com/2009/5/26/list-based-menu---xslt.aspx</link><pubDate>Tue, 26 May 2009 13:49:11 GMT</pubDate><guid>http://www.bysquirrels.com/2009/5/26/list-based-menu---xslt.aspx</guid><content:encoded><![CDATA[ 
<h3>List based Menu - XSLT</h3>

<p>Its rare to build a site which doesn't have some kind of
navigation structure. This is an example of a nice bit of re-usable
XSLT code to build site navigation. In our parent documents we have
a two fields, one called navMainName and another called
navMainSort. When a document has text in the 'navMainName' field,
we include it in the navigation.</p>

<p>This XSLT also adds an 'active' to the class of the area of the
site the user is browsing, using some CSS you can apply a different
style to this.</p>

<pre>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE xsl:stylesheet [
    &lt;!ENTITY nbsp "&amp;#x00A0;"&gt;
]&gt;
&lt;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"&gt;


    &lt;xsl:output method="xml" omit-xml-declaration="yes"/&gt;
    &lt;xsl:param name="currentPage"/&gt;
    &lt;xsl:template match="/"&gt;

      &lt;!-- Request the value for siteRoot, and define it as a variable --&gt;
      &lt;xsl:variable name="siteRoot"&gt;
        &lt;xsl:value-of select="$currentPage/ancestor::root/node/@id"/&gt;
      &lt;/xsl:variable&gt;

      &lt;ul&gt;
        &lt;!-- Static List item for siteRoot (e.g. Home) --&gt;
        &lt;li&gt;
          &lt;a&gt;
            &lt;xsl:attribute name="class"&gt;
              &lt;xsl:if test="$currentPage/@id = $siteRoot"&gt;
                active
              &lt;/xsl:if&gt;
            &lt;/xsl:attribute&gt;
            &lt;xsl:attribute name="href"&gt;/&lt;/xsl:attribute&gt;
            home
          &lt;/a&gt;
          &lt;/li&gt;
        &lt;!-- Select each node which is a child of site root --&gt;
        &lt;xsl:for-each select="$currentPage/ancestor::root/node/node"&gt;
          &lt;!-- Sort this data by nav Sort Order, defined on docType --&gt;
          &lt;xsl:sort select="string(data[@alias= 'navMainSort'])" order="ascending" /&gt;
          &lt;!-- Pick the documents which have a tabName, and build a menu from them --&gt;
          &lt;xsl:choose&gt;
            &lt;xsl:when test="string(data[@alias= 'navMainName']) != ''"&gt;
              &lt;li&gt;
                &lt;a&gt;
                  &lt;xsl:attribute name="class"&gt;
                    &lt;!-- Compare ID to determine which page is active, using ancestor-self::node allows for sub pages! ;) Neat ay! --&gt;
                    &lt;xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id"&gt;
                      active
                    &lt;/xsl:if&gt;
                  &lt;/xsl:attribute&gt;
                  &lt;xsl:attribute name="href"&gt;
                    &lt;xsl:value-of select="umbraco.library:NiceUrl(@id)"/&gt;
                  &lt;/xsl:attribute&gt;
                  &lt;xsl:value-of select="data[@alias= 'navMainName']" /&gt;
                &lt;/a&gt;
              &lt;/li&gt;
            &lt;/xsl:when&gt;
            &lt;xsl:otherwise&gt;
            &lt;/xsl:otherwise&gt;
          &lt;/xsl:choose&gt;
        &lt;/xsl:for-each&gt;        
      &lt;/ul&gt;

    &lt;/xsl:template&gt;

&lt;/xsl:stylesheet&gt;
</pre>

<p>Hopefully thats a useful bit of reusable code for you. (:
Lau</p>
]]></content:encoded></item><item><title>Naming Conventions for XSLT</title><link>http://www.bysquirrels.com/2009/5/20/naming-conventions-for-xslt.aspx</link><pubDate>Wed, 20 May 2009 17:22:35 GMT</pubDate><guid>http://www.bysquirrels.com/2009/5/20/naming-conventions-for-xslt.aspx</guid><content:encoded><![CDATA[ 
<h3>Naming Conventions - XSLT filenames and Macros</h3>

<p>We prefix all our macros and xslt files with a word which
describes the function of the code. This encourages developers to
reuse existing code, improves organisation in the backend and
speeds up templating and workflow.</p>

<ul>
<li>- Get</li>

<li>- Merge</li>

<li>- List</li>

<li>- Ext</li>

<li>- Nav</li>

<li>- Library</li>

<li>- Meta</li>
</ul>

<p><strong><br />
(get)</strong> - $currentPage data specific. E.g get Header, get
Body, get Image.</p>

<p><strong>(merge)</strong> - $currentPage/nodes specific, display
childen at any depth, used for content mash ups.</p>

<p><strong>(list)</strong> - Similar to merge, but should only be
used for list data.</p>

<p><strong>(ext)</strong> - Used to output code to other
applications, e.g Flash, RSS Feeds, XML (sitemaps), etc</p>

<p><strong>(nav)</strong> - Used for any navigation code.</p>

<p><strong>(library)</strong> - References a set of code used by
other code.</p>

<p><strong>(meta)</strong> - Code used to display meta
elements.</p>

<p>Any suggestions, or ideas are welcome! :) but this document will
make the macro's in future blog posts make more sense.</p>

<h4>Examples...</h4>

<ul>
<li>(ext)GoogleSiteMap</li>

<li>(nav)Level1-FrontPage</li>

<li>(list)NewsItems</li>
</ul>
]]></content:encoded></item><item><title>Master Templates</title><link>http://www.bysquirrels.com/2009/5/20/master-templates.aspx</link><pubDate>Wed, 20 May 2009 16:14:14 GMT</pubDate><guid>http://www.bysquirrels.com/2009/5/20/master-templates.aspx</guid><content:encoded><![CDATA[ 
<h3>Templates</h3>

<h4>Master Template and Macro's<br />
</h4>

<p>Templating within any CMS is a very important factor and is
often a huge stumbling block. Luckily within Umbraco templating is
really easy and incredibly quick. Great!</p>

<p>We approach all our projects using a standard template, and then
fill in the gaps during the projects development phase.</p>

<p>First off we create a template called 'Public Master', this is
the master template for our site and contains things which are on
every page (e.g. page title, header, meta, navigation, and footer)
this template will also contain a 'ContentPlaceHolder' which pulls
in different child templates depending on the page being rendered
(more on this later).</p>

<p>If you have a look at the code below you'll see we don't use
inline xslt - this is for a simple reason that it doesn't cache
&amp; personally I think its terrible practice leading to messy
templates and general confusion. All our template content is pulled
in using XSLT macros. We've got a couple of basic macro's which
augment our basic DocTypes (blog on these soon!)</p>

<ol>
<li>(get)PageTitle</li>

<li>(meta)Common</li>

<li>(get)Header</li>
</ol>

<p>You might want to add some additional ones, but I can't think of
many projects we do which doesn't use at least these ones! ;)</p>

<p>Right so lets have a quick look at the MasterTemplate...</p>

<h4>Master Template - <em>Public Master</em></h4>

<pre>
&lt;%@ Master Language="C#" MasterPageFile="/umbraco/masterpages/default.master" AutoEventWireup="true" %&gt;
&lt;asp:Content id="PublicMasterContent" ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server"&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;

&lt;head id="head" runat="server"&gt;
    
    &lt;title&gt;&lt;umbraco:Macro Alias="(get)PageTitle" runat="server"&gt;&lt;/umbraco:Macro&gt;&lt;/title&gt;
    
    &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"/&gt;
    &lt;meta http-equiv="Content-Language" content="en" /&gt;
    &lt;meta http-equiv="X-UA-Compatible" content="IE=7;FF=3;OtherUA=4" /&gt;

    &lt;!-- site meta information - author, desc, keywords, company, copyright, rss feed--&gt;
    &lt;umbraco:Macro Alias="(meta)Common" runat="server"&gt;&lt;/umbraco:Macro&gt;

    &lt;!-- remember to add the constant values in beneath this, e.g copyright, author, etc --&gt;

    &lt;!-- disable MS tools --&gt;
    &lt;meta http-equiv="imagetoolbar" content="no" /&gt;

    &lt;!-- stylesheets --&gt;
    &lt;link rel="stylesheet" type="text/css" href="/css/Layout.css" title="SITE NAME" media="screen" /&gt;

    &lt;!-- javascript entries --&gt;
    &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" src="/Scripts/JS/main.js"&gt;&lt;/script&gt;
    
&lt;/head&gt;

&lt;body id="pageName"&gt;     
    &lt;div id="container"&gt;
        &lt;div id="header"&gt;
            &lt;!-- Header --&gt;
            &lt;umbraco:Macro Alias="(get)Header" runat="server"&gt;&lt;/umbraco:Macro&gt;

            &lt;div id="nav"&gt;
                Navigation Goes Here.
            &lt;/div&gt;
        &lt;/div&gt;   

        &lt;!-- Start Content Link for Screen Readers, remember to implement this --&gt;
        &lt;a name="startcontent" id="startcontent"&gt;&lt;/a&gt;

        &lt;div id="content" class="content"&gt;
            &lt;form id="PublicMasterForm" runat="server"&gt;
                &lt;asp:ContentPlaceHolder ID="PublicMasterContentPlaceHolder" runat="server"&gt;&lt;/asp:ContentPlaceHolder&gt;
            &lt;/form&gt;
        &lt;/div&gt;

        &lt;div id="footer"&gt;
            Footer Goes Here.
        &lt;/div&gt;
    &lt;/div&gt;

&lt;!-- Remember to Insert Google Analytics code here --&gt;

&lt;/body&gt;

&lt;/html&gt;

&lt;/asp:content&gt;
</pre>

<p>Okay so you've had a look at the 'Public Master' template, and
hopefully your pretty happy with it.</p>

<p>Lets quickly run through our Macro's. (you'll need to drill into
the Developers tab, right click on XSLT and create these! Its not
hard, don't worry!)</p>

<h4>Macro - (get)PageTitle</h4>

<p>Okay, so in our 'site root' doc-type we always create a field
called 'Site Name' it makes alot of sense and we're gonna use this
all over the place so its great to have it defined in the site root
doc. In all our children pages we have a field called, 'bodyHeader'
- nice and simple this is the Header of the page. (we quite often
also have an SEO tab, with an alternative title for SEO
optimisation which will override this).</p>

<p>So we want to grab the Site Title, and then if a body header is
present we want to add '- Body Header' after the sitename.
Standard.</p>

<p>So our XSLT looks something like this...</p>

<pre>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE xsl:stylesheet [
    &lt;!ENTITY nbsp "&amp;#x00A0;"&gt;
]&gt;
&lt;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" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
    exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets "&gt;

    &lt;xsl:output method="xml" omit-xml-declaration="yes"/&gt;
    &lt;xsl:param name="currentPage"/&gt;
    &lt;xsl:template match="/"&gt;

        &lt;xsl:for-each select="$currentPage"&gt;
            &lt;xsl:value-of select="$currentPage/ancestor::root/node/data [@alias = 'siteName']" /&gt;
            &lt;xsl:choose&gt;
                &lt;xsl:when test="string(data[@alias= 'bodyHeader']) != ''"&gt;
                    - &lt;xsl:value-of select="data [@alias = 'bodyHeader']"/&gt;
                &lt;/xsl:when&gt;
                &lt;xsl:otherwise&gt;
                    
                 &lt;/xsl:otherwise&gt;
            &lt;/xsl:choose&gt;
        &lt;/xsl:for-each&gt;

    &lt;/xsl:template&gt;

&lt;/xsl:stylesheet&gt;
</pre>

<p>Nice so thats page titles sorted across our whole site!</p>

<h4>Macro - (meta)Common<br />
</h4>

<p>So this one sorts out the meta data for our pages, this is kinda
important and as we don't want the same meta data on every page
XSLT is really a great solution...</p>

<p>The first thing we need to do is strip out any tags from our
content pages we're going to do this really quickly just by setting
up a variable and use a nice Umbraco extension to replace any
&lt;tags&gt; with ' ' e.g. nothing! BTW - this code could do with
some improvement, because when you strip out a P or a BR you lose
the space and words end up getting joined together. (feel free to
do this)</p>

<p>So now we've got our handy variables set up for the
<em>metaDescription</em> and the <em>contentBody</em> we're going
to define our meta tags for description. In here we've got a little
logic that says, hey is there any body text (you'd hope there is!)
and if so, it pulls this text from our variable and then truncates
it down to 380 letters. This is so its nice and compact for search
engines to read and doesn't fill your header up with the entire
page content!</p>

<p>If the page doesn't have any content, we just default back to
the root page's meta description (note we are using the same
alias). E.g so on your root page the description you've defined in
the metaDescription will be used. (on our site, this
metaDescription &amp; metaKeywords is inherited by all children
nodes)</p>

<p>Next we move onto keywords, these are also kinda
important...</p>

<p>On all our content pages I've made field called metaKeywords
which is a simple textbox, and allows user to add the keywords as a
comma seperated list. All we do now is pull these tags in, and
after these tags have been added we add the keywords defined in the
root in as well. We do this by altering the XPATH.</p>

<pre>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE xsl:stylesheet [ &lt;!ENTITY nbsp "&amp;#x00A0;"&gt; ]&gt;
&lt;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" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" 
    exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets "&gt;


&lt;xsl:output method="xml" omit-xml-declaration="yes"/&gt;

&lt;xsl:param name="currentPage"/&gt;

&lt;xsl:variable name="description" select="umbraco.library:Replace(umbraco.library:Replace(umbraco.library:StripHtml($currentPage/data [@alias = 'metaDescription']),'&amp;#xD;',''),'&amp;#xA;','')" /&gt;
&lt;xsl:variable name="content" select="umbraco.library:Replace(umbraco.library:Replace(umbraco.library:StripHtml($currentPage/data [@alias = 'contentBody']),'&amp;#xD;',''),'&amp;#xA;','')" /&gt;

&lt;xsl:template match="/"&gt;

&lt;meta&gt;
    &lt;xsl:attribute name="name"&gt;description&lt;/xsl:attribute&gt;
    &lt;xsl:choose&gt;
        &lt;xsl:when test="$content=''" &gt;
            &lt;xsl:attribute name="content"&gt;&lt;xsl:value-of select="umbraco.library:TruncateString($content, '380', '')" disable-output-escaping="yes"/&gt;&lt;/xsl:attribute&gt;
        &lt;/xsl:when&gt;
        &lt;xsl:otherwise&gt;
            &lt;xsl:attribute name="content"&gt;&lt;xsl:value-of select="$description" disable-output-escaping="yes"/&gt;&lt;/xsl:attribute&gt;
        &lt;/xsl:otherwise&gt;  
    &lt;/xsl:choose&gt;
&lt;/meta&gt;

&lt;meta&gt;
&lt;xsl:attribute name="name"&gt;keywords&lt;/xsl:attribute&gt;
&lt;xsl:attribute name="content"&gt;,
    &lt;xsl:value-of select="$currentPage/data [@alias = 'metaKeywords']" disable-output-escaping="yes"/&gt; ,
    &lt;xsl:value-of select="$currentPage/ancestor-or-self::node/data [@alias = 'metaKeywords']"  disable-output-escaping="yes"/&gt;
&lt;/xsl:attribute&gt;
&lt;/meta&gt;
&lt;/xsl:template&gt;
&lt;/xsl:stylesheet&gt;
</pre>

<p>Okay so we've sorted out the areas in the meta data which
changes depending on the page.</p>

<h4>Macro -(get)Header</h4>

<p>Okay so next we want to pull in the site's name and description
to build our header. Because google looks at the first part of the
page it sometimes makes sense to push a description into this area
of the page. Generally your users don't need to see this so we've
just given the description a class of 'hidden' which via your CSS
you could set to '.hidden {display="none"}'. Its a pretty useful
class to have in your CSS anyway, so you were probally thinking of
having it anyway right?</p>

<p>All we're doing is looking at the root document and pulling in
the siteName in. Again you might just use CSS and do an image
replacement technique on the header, but its still important the
correct text is there as there are people out there who use screen
readers, or turn off your stylesheet to make digesting the
information easier. (not that your design sucks or anything, but
schematic design IS important!)</p>

<p>Again we do the same with description, but with that added class
tag so we can just hide this.</p>

<pre>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE xsl:stylesheet [
    &lt;!ENTITY nbsp "&amp;#x00A0;"&gt;
]&gt;
&lt;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" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
    exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets "&gt;

    &lt;xsl:output method="xml" omit-xml-declaration="yes"/&gt;
    &lt;xsl:param name="currentPage"/&gt;
    &lt;xsl:template match="/"&gt;

        &lt;h1 id="siteName"&gt;
            &lt;a href="/" title="Click to navigate to the Home Page"&gt;
                &lt;xsl:value-of select="$currentPage/ancestor::root/node/data [@alias = 'siteName']" /&gt;
            &lt;/a&gt;
        &lt;/h1&gt;
        &lt;h2 id="siteDescription" class="hidden"&gt;
            &lt;xsl:value-of select="$currentPage/ancestor::root/node/data [@alias = 'siteDescription']"/&gt;
        &lt;/h2&gt;

    &lt;/xsl:template&gt;

&lt;/xsl:stylesheet&gt;
</pre>

<p>More on children templates tommorow! ;) L</p>
]]></content:encoded></item><item><title>Umbraco Upgrade Guide</title><link>http://www.bysquirrels.com/2009/5/8/umbraco-upgrade-guide.aspx</link><pubDate>Fri, 08 May 2009 14:57:54 GMT</pubDate><guid>http://www.bysquirrels.com/2009/5/8/umbraco-upgrade-guide.aspx</guid><content:encoded><![CDATA[ 
<h4>Upgrading Umbraco</h4>

<p>Stop IIS Site (this is really important!)</p>

<p>Download the new version of Umbraco, and copy across these
folders to your wwwroot folder.</p>

<p>/bin<br />
/umbraco<br />
/umbraco_client<br />
/install</p>

<p>Question Overwrite Files = YES<br />
Recheck file permissions (<a
href="/2009/5/7/umbraco-install-guide.aspx"
title="Umbraco Install Guide">see install guide here</a>)</p>

<p><em>*If you are upgrading Umbraco 3 to 4, you may have old
packages which are not compatible with datalayer (photo crop tool
for example). A short term fix for this issue is to open the
web.config file and remove 'datalayer' from the database
string.</em></p>
]]></content:encoded></item><item><title>Umbraco Install Guide</title><link>http://www.bysquirrels.com/2009/5/7/umbraco-install-guide.aspx</link><pubDate>Thu, 07 May 2009 17:38:25 GMT</pubDate><guid>http://www.bysquirrels.com/2009/5/7/umbraco-install-guide.aspx</guid><content:encoded><![CDATA[ 
<h3>Installations - Windows 2008, SQL2008</h3>

<p>Download the latest version of Umbraco from Codeplex.</p>

<p><a href="http://codeplex.com/umbraco"
title="Umbraco Codeplex Page">http://codeplex.com/umbraco</a></p>

<p>Create a new site folder. Our usual format would be the domain
name, with a sub folder called 'wwwroot'.</p>

<p>/inet/domainname.com/wwwroot/{umbraco files}</p>

<p>Extract the files into 'wwwroot'.</p>

<p>Follow the permissions guide below, once this is done setup a
new IIS instance and configure the nesserary bindings. Remeber to
change the pipeline to Classic, not integrated. (we'll be blogging
the integrated walk through soon).</p>

<h4>Permissions - NETWORK SERVICE, Full Control</h4>

<p style="padding-left: 30px;">App_code<br />
 Bin<br />
 Config<br />
 CSS<br />
 Data<br />
 Masterpages<br />
 Media<br />
 Python<br />
 Scripts<br />
 Umbraco<br />
 User Controls<br />
 XSLT<br />
<br />
 web.config (this can be locked down after installation)</p>

<p>Okay, so our permissions are looking great, but we still need to
setup the database. Lets do that now...</p>

<h4>Database Setup</h4>

<p>Open up 'SQL Server Management Studio', and connect in.</p>

<p>On the right hand pane you'll see the 'Database' tab. Right
click on this and create a new database by selecting 'New
Database'.</p>

<p>We use the naming convention 'applicationTYPEsiteinitials.</p>

<p>For this site it would be...</p>

<p><em>umbracoCMSbs</em></p>

<p>Next we need to create a user so Umbraco can access the
database, write &amp; read data.</p>

<h4>Creating a User</h4>

<p>Underneath 'Database' you'll see a tab called 'Security', click
on the [+] to open up the children items. One of the items that
appears is 'Logins' right click on this and select 'New
Login...'.</p>

<p>The 'Login - New' dialogue box will appear. The first thing we
need to do is supply a 'Login Name'. Again we use the same naming
convention, so an example would be <em>umbracoUserbs</em>.</p>

<p>Change the authentication to 'SQL Server Authentication' and
specify a password. As default SQL passwords expire after 30 days,
if this is an issue for your enviroment and should either
check/change the password policy and simply uncheck the enforcement
boxes.</p>

<p>Next set the default database to the database you setup
earlier.</p>

<p>Now click on the 'User Mappings' tab and check the checkbox next
to your database. You now need to set the database roles. These
are; Datareader, Datawriter, DB_Owner and Public.</p>

<p>-</p>

<p>Okay so we've setup IIS, the file permissions and the SQL
database. Navigate to your sites URL (probally localhost) and
follow the Umbraco installer.</p>
]]></content:encoded></item><item><title>Introduction</title><link>http://www.bysquirrels.com/2009/5/7/introduction.aspx</link><pubDate>Thu, 07 May 2009 16:48:22 GMT</pubDate><guid>http://www.bysquirrels.com/2009/5/7/introduction.aspx</guid><content:encoded><![CDATA[ 
<p>Hi, this is our Umbraco development blog.</p>

<p>bySquirrels are the team of developers at <a
href="http://www.voodoodog.com/"
title="VooDooDog - London Based Creative Studio">VooDooDog</a>.</p>

<p>You can follow and chat with myself on twitter (uniquelau).</p>

<p>The main aim of this blog is to document the work we're doing
with Umbraco, some posts will be very basic and some will be more
advanced. We've been working with Umbraco for the last 9 months and
over that time I've been writing reference documents so new people
to our team/freelancers can quickly pick up Umbraco practices.</p>

<p>Hope you find something of use! ;)</p>

<p>Lau from VooDooDog</p>
]]></content:encoded></item></channel></rss>
