<?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>Percipient Blog</title><copyright>Copyright 2009, Percipient Studios. All rights reserved.</copyright><link>http://blog.percipientstudios.com</link><pubDate></pubDate><generator>umbraco</generator><description></description><image><url>http://blog.percipientstudios.com/images/logo-brand-blog-55.png</url><title>Percipient Blog</title><link>http://blog.percipientstudios.com</link></image><language>en</language><item><title>How To: ImageGen 2.5 with Umbraco 5</title><link>http://blog.percipientstudios.com/2012/2/1/how-to-imagegen-25-with-umbraco-5.aspx</link><pubDate>Wed, 01 Feb 2012 11:55:53 GMT</pubDate><guid>http://blog.percipientstudios.com/2012/2/1/how-to-imagegen-25-with-umbraco-5.aspx</guid><description>
&lt;p&gt;Learn how to use your old friend ImageGen 2.5 with the brand
spanking new Umbraco v5. It's quick, simple, and very powerful!&lt;/p&gt;
</description><author>info@percipientstudios.com (Douglas Robar)</author><content:encoded><![CDATA[    <p>
        Did you know that ImageGen isn't only for Umbraco sites? That's right, you can use ImageGen with <em>any</em>
        .net 2.0 (or higher) website because it isn't tied to any specific Umbraco version.</p>
    <p>
        So... does that mean I can you use the same ImageGen that I've enjoyed using with my Umbraco 4 sites with
        the all new, mvc-based Umbraco 5?<br />
        <strong>YES!</strong></p>
    <p>
        <em><strong>Disclaimer:</strong> these steps are a workaround until I get an updated
            version of ImageGen released that properly supports Umbraco 5's plugin architecture.
            When that's released you'll be able to install the package directly and not worry
            about this blog post. Okay? Okay.</em></p>
    <h2>
        Manual Installation</h2>
    <ol>
        <li>Download the ImageGen .zip package created for Umbraco v4<br />
            <a href="http://our.umbraco.org/projects/website-utilities/imagegen">http://our.umbraco.org/projects/website-utilities/imagegen</a>
        </li>
        <li>Extract the .zip file to a temporary folder</li>
        <li>View the expanded files and copy the following files to your Umbraco v5.0 website<br />
            <ul>
                <li>ImageGen.ashx goes in the root of your site</li>
                <li>ImageGen.config goes in the root of your site</li>
                <li>ImageGen.dll goes in the 'bin' folder of your site</li>
            </ul>
        </li>
        <li>Update the Web.config file in the root of your site to add the lines that have ImageGen in them:<br />
            <pre class="brush: xml;">
 &lt;configuration&gt;
   &lt;configSections&gt;
      &lt;section name=&quot;ImageGenConfiguration&quot; type=&quot;ImageGen.ImageGenConfigurationHandler,ImageGen&quot; /&gt;
   &lt;/configSections&gt;

   &lt;ImageGenConfiguration configSource=&quot;ImageGen.config&quot; /&gt;
&lt;/configuration&gt;
</pre>
        </li>
        <li>Verify the installation by viewing <a href="http://localhost/imagegen.ashx?version">
            http://localhost/imagegen.ashx?version</a>
            <br />
            (replacing localhost with your site's domain and/or port number)<br />
            <br />
            You should see a result like the following:<br />
            <br />
            <em>ImageGen Professional version 2.5.7.27945<br />
                Professional features are available for localhost<br />
                Professional features are available for *.local<br />
            </em></li>
    </ol>
    <h2>
        Razor Code for using ImageGen</h2>
    <p>
        You can use this same Razor code in a macro or directly in your template.</p>
    <p>
        For these examples I've created two document type properties. One is an Uploader
        field and the other is a Media Picker. Since they behave slightly differently it's
        worth seeing both.</p>
    <h3>
        Using ImageGen with an Uploader property called uploadImage</h3>
    <pre class="brush: xml;">
 &lt;p&gt;Original image:&lt;br /&gt;
   &lt;img src=&quot;@Umbraco.GetMediaUrl(Model.Id, &quot;uploadImage&quot;)&quot; width=&quot;200&quot; /&gt;
&lt;/p&gt;

&lt;p&gt;Resized image:&lt;br /&gt;
   &lt;img src=&quot;/imagegen.ashx?width=200&image=@Umbraco.GetMediaUrl(Model.Id, &quot;uploadImage&quot;)&quot; /&gt;
&lt;/p&gt;
</pre>
    <h3>
        Using ImageGen with a MediaPicker property called mediaImage</h3>
    <pre class="brush: xml;">
 &lt;p&gt;Original image:&lt;br /&gt;
   &lt;img src=&quot;@Umbraco.GetMediaUrl(DynamicModel.MediaImage, &quot;uploadedFile&quot;)&quot; width=&quot;200&quot; /&gt;
&lt;/p&gt;

&lt;p&gt;Resized image:&lt;br /&gt;
   &lt;img src=&quot;/imagegen.ashx?width=200&image=@Umbraco.GetMediaUrl(DynamicModel.MediaImage, &quot;uploadedFile&quot;)&quot; /&gt;
&lt;/p&gt;
</pre>
    <p>
        <strong>Tip: </strong>for more elaborate Razor macro inspriation, check out Warren
        Buckley's GitHub collection of snippets at <a href="https://gist.github.com/warrenbuckley">
            https://gist.github.com/warrenbuckley</a></p>
    <h2>
        Remote, Cloud, and Non-Local Images</h2>
    <p>
        The above works perfectly for images stored locally. If your images aren't stored
        locally on the web server it won't work.</p>
    <p>
        But... <strong>ImageGen Professional's "Remote Images" saves the day!</strong></p>
    <p>
        You just need to include the full url to the image in your call to ImageGen.ashx,
        and update the ImageGen.config file to whitelist your domain(s) to make it work.
        The <a href="http://our.umbraco.org/projects/website-utilities/imagegen">ImageGen Reference
            Manaul</a> explains whitelisting and remote urls.</p>
    <p>
        As an added benefit, with ImageGen Professional you can turn on client-side image
        caching, which can greatly improve the performance of your site, especially with
        remote images that might have some latency in fetching.</p>
    <p>
        ImageGen Professional's remote image capability works for images served from a remote
        website (flickr, twitter, etc.), those stored in the cloud (EC2, Amazon, etc.),
        saved as blobs in a database, and with all future Hive providers. With ImageGen
        Professional you can rock them all.</p>
    <p>
        &nbsp;</p>
    <p>
        ...and that's all there is to it!</p>]]></content:encoded></item><item><title>Help, I need my passport back</title><link>http://blog.percipientstudios.com/2011/6/1/help,-i-need-my-passport-back.aspx</link><pubDate>Wed, 01 Jun 2011 10:53:17 GMT</pubDate><guid>http://blog.percipientstudios.com/2011/6/1/help,-i-need-my-passport-back.aspx</guid><description>
&lt;p&gt;In order to travel to the annual CodeGarden conference I need my
visa application approved and passport returned from the UK Home
Office Border Agency within the next two weeks.&lt;/p&gt;

&lt;p&gt;Update: Your help has returned my passport in time!&lt;/p&gt;
</description><author>info@percipientstudios.com (Douglas Robar)</author><content:encoded><![CDATA[ <h2>The short of it</h2>

<p><strong>In order to travel to the annual CodeGarden conference I
need my visa application approved and passport returned from the UK
Home Office Border Agency within the next week.</strong></p>

<p><del><a href="#help">Yes, you can help!</a></del></p>
<p>We now have an <a href="#answer">answer</a></p>

<p><strong>I am requesting an expedited decision of my case, now
two months old.</strong></p>

<p>Applicant: Douglas James Robar<br />
Case Ref: 014264466</p>

<p>&nbsp;</p>

<h2>The long of it</h2>

<p>I'm an <strong>American living in Cambridge</strong> UK for 2.5
years. My wife is a PhD student at Cambridge University and has a
student visa. I have a student dependant visa that allows me to
work in the UK.</p>

<p><strong>I own and run <a
href="http://www.percipientstudios.com">Percipient
Studios</a></strong>. Not only do I offer website design and
implementations using the Umbraco CMS, I am also the only official
Umbraco Level 1 Trainer in the UK and have taught hundreds of UK
software developers, webmasters, and IT staff attain the valuable
<a
href="http://umbraco.com/certified-partners/find-a-certified-developer">
Umbraco Certified Developer</a> certification and tens of
organisations become <a
href="http://umbraco.com/certified-partners/browse-solution-providers">
Umbraco Solution Providers</a>.</p>

<p>I like being in the UK. My family and I would like to stay for
some time even after my wife finishes her PhD. And I want to
continue my business here.</p>

<p>For this I need a new visa and have <strong>applied for a <a
href="http://www.ukba.homeoffice.gov.uk/workingintheuk/tier1/general/">
Tier 1 General</a> visa</strong>. I fully qualify according to that
points-based system, provided all needed documentation and
biometric evidence, and even used the excellent <a
href="http://www.globalvisas.com/">Global Visas</a> to ensure a
flawless application. My application was delivered before the
deadline of 4-April (<strong>two months ago</strong>).</p>

<p>In mid-June I am to give a <a
href="http://codegarden11.com/sessions/day-2/slot-one/did-you-know.aspx">
presentation</a> at the annual Umbraco conference, <a
href="http://codegarden11.com/">CodeGarden</a>, and will also be
moderating a panel discussion. CodeGarden (twitter: <a
href="http://twitter.com/#!/search/%23CG11">#CG11</a>) is
<strong>the single most important event of the year for my
business</strong>; I get work as a direct result of attending in
addition to its being a key source for my own professional
development in the field.</p>

<p>Though the Home Office suggests that <a
href="http://www.ukba.homeoffice.gov.uk/workingintheuk/tier1/general/waitingtimes/">
75% of cases are decided within four weeks</a>, my case is still
outstanding after 8 weeks.</p>

<p>I need a miracle. The Home Office won't discuss my case with me
until <a
href="http://www.ukba.homeoffice.gov.uk/while-in-uk/travel-abroad/traveldocuments/applying/waitingtimes/">
14 weeks have passed</a>. I've called. Multiple times. It will only
(only?) have been ten weeks by the time CodeGarden begins. But
<strong>without my approved visa and passport returned I can't
leave the country</strong>.</p>

<p>I had thought of getting an emergency second passport from the
US Embassy in London (which they can do within 36 hours). But have
found out from the Home Office that if I leave the UK before my
visa has been issued, even on a valid passport, my visa application
will automatically and immediately be cancelled.</p>

<p>&nbsp;</p>

<h2>Updates</h2>
<h3>25-May</h3>

<p>At the Home Office's recommendation I have faxed a request for
urgency to 0114 207 2536. I was told that no reply to my request
will be given and no assurance can be made of fulfilling my request
for urgency. Also at the HO's recommendation my fax included the
important "do not withdraw my application" sentence. I'm not sure
why this should be necessary but twice I was told it should appear
on the fax.</p>

<h3>1 June</h3>

<p>Blog post and tweet to escalate issue in the hope that something
can be done to ensure I will be able to attend the CodeGarden
conference.</p>

<p>UPDATE: I contacted my local MP (<a title="Julian Huppert"
href="http://www.julianhuppert.org.uk/">Julian Huppert</a>, twitter
<a title="@julianhuppert"
href="http://twitter.com/#!/julianhuppert">@julianhuppert</a>) at
the recommendation of many and his office was very responsive. They
called me back within two hours with the news that "You will be
pleased to know your application is nearing the end of the review
process and you will be hearing shortly." I then asked when
"shortly" might be. "If you have not heard from UKBA by Sunday 12th
June please do contact Julian again."</p>

<h3>2 June</h3>

<p>Potentially hearing something by 12 June is not sufficient - I
would then still need to wait to receive my passport by post.
<strong>I am still looking for assistance to successfully complete
my visa application and return my passport (in my hands) by 9
June</strong>. That's only one week away.</p>

<p>Others have suggested these avenues, which I will be following
up on:</p>

<ul>
<li>"Contact the US Embassy Consular Affairs section and have them
intervene on his behalf. They are the only outsiders with enough
juice to make it happen."</li>

<li>Continue tweeting and include <a title="@UKBorderAgency_"
href="http://twitter.com/#!/UKBorderAgency_/">@UKBorderAgency_</a>
<a title="@UKBAinUSA"
href="http://twitter.com/#!/UKBAinUSA/">@UKBAinUSA</a> and possibly
others.</li>

<li>Contact Jim Paice, MP for SE Cambs and somehow involved with
the UK Border Agency.</li>

<li><em>If you have other suggestions please leave them in the
comments!</em></li>
</ul>

<p>UPDATE: <a
href="http://www.benjaminhowarth.com">Benjamin Howarth</a> has
contacted his MP and discovered <em>&quot;<strong>MPs have access routes to
the UK Passport Agency that are not available to the
public</strong>, so Julian Huppert is your best bet.
<strong>Letters of commercial support as well are also
helpful</strong> apparently, so I sorted a petition for you: <a
href="http://www.petitiononline.com/drobar11/petition.html">http://www.petitiononline.com/drobar11/petition.html</a>&quot;</em></p>

<h3>3 June</h3>

<p>The volume of <a
href="http://www.petitiononline.com/mod_perl/signed.cgi?drobar11">petition
signatures</a> (currently 140 signatures!), tweets, retweets, and
outpouring of concern and support is overwhelming. Thank you!</p>

<p>I've emailed my MP again and am awaiting a response. I'll keep
you posted, and as ever please accept my deep thanks and let me
know if you or someone you know can assist in expediting the
approval and return of my visa application and passport.</p>

<h3>4 June</h3>

<p><strong>Things seem to be moving!</strong></p>
<p>I received this note from Julian Huppert's office today:<br />
<em>&quot;I have been in touch with the UK Border Agency about the need for Doug
to receive the determination of his visa application and passport
returned. <strong>The issue has been referred to the Border Agency MP Account
Managers Office. I will contact them again first thing on Monday
morning and let you know the outcome.</strong>&quot;</em>
</p>

<h3>6 June</h3>
<p>So far there are <a 
href="http://www.petitiononline.com/mod_perl/signed.cgi?drobar11">177 
signatures on the petition</a>, thank you!</p>

<p>&nbsp;</p>

<h2 id="help">Please help</h2>

<p><del>If you know anyone at the Home Office or Border Agency I
would greatly appreciate your assistance.</del></p>

<p><del>Please sign my petition at <a
href="http://www.petitiononline.com/drobar11/petition.html">http://www.petitiononline.com/drobar11/petition.html</a>.</del></p>

<p><del>Email a personal recommendation to my MP, <a
href="mailto:julianhuppertmp@gmail.com?subject=Recommendation for Douglas Robar's visa application">
Julian Huppert</a> to give urgency to Douglas Robar's visa
application.</del></p>

<p>We now have an <a href="#answer">answer</a>.</p>


<h2 id="answer">Good and bad news</h2>
<p>I just heard from from Julian Huppert's office, who have been 
tremendously helpful. There is good news and bad news:</p>
<ul>
<li><strong>Good news = My passport will be dispatched today!</strong></li>
<li>Bad news = my Tier 1 General visa application was denied</li>
</ul>
<p>This means I can attend CodeGarden! And my existing visa is still in force 
so I can stay and work in the UK until my wife completes here PhD sometime 
in the next year.</p>
<p>I have hugely mixed emotions right now. On the one hand I am disappointed 
in the visa decision (I'll find out the reason when I receive the paperwork via post
in a few days). On the other hand <strong>I'm overwhelmed by all for your efforts, good wishes, and prayers!</strong> How could one man be blessed with so many great friends and colleagues?</p>

<p>&nbsp;</p>


<p>Thank you!<br />
doug.</p>

<p>&nbsp;</p>
]]></content:encoded></item><item><title>How To: Umbraco Razor Intellisense and Debugging</title><link>http://blog.percipientstudios.com/2011/3/3/how-to-umbraco-razor-intellisense-and-debugging.aspx</link><pubDate>Thu, 03 Mar 2011 10:55:40 GMT</pubDate><guid>http://blog.percipientstudios.com/2011/3/3/how-to-umbraco-razor-intellisense-and-debugging.aspx</guid><description>
&lt;p&gt;With Umbraco 4.7, Razor just might be the go-to language for
most macros from now on. Unfortunately, even with Visual Studio
2010, intellisense was missing for @Model, the single most
important part of a Razor macro.&lt;/p&gt;

&lt;p&gt;This short video demonstrates how you can get some intellisense
love for your Umbraco Razor macros. I also show you how easy it is
to debug Razor macros without compiling any code.&lt;/p&gt;
</description><author>info@percipientstudios.com (Douglas Robar)</author><content:encoded><![CDATA[ <h2>Razor, a new Umbraco macro language</h2>

<p><a href="http://umbraco.codeplex.com/releases/view/59502">Umbraco 4.7 RC</a> has an all-new <a href="http://umbraco.com/follow-us/blog-archive/2011/3/1/umbraco-razor-feature-walkthrough-%E2%80%93-part-4">Razor macro engine</a>, a foretaste of the coming MVC goodness of <a href="http://umbraco.com/follow-us/blog-archive/2010/11/26/umbraco-5-may-the-blogging-commence">Umbraco 5</a>.</p>

<p>As everyone knows, I'm an XSLT fanboy; it is lightning quick, powerful, an open standard, and I don't have to open a Visual Studio solution every time I want to make a minor change. Besides, my C# skills aren't amazing. Thankfully with Umbraco, I don't need to be a .NET guru.</p>

<p>I've always been a little uncomfortable with how wide the gap is between XSLT and .NET macros though. With Razor, we may have found the middle ground. Razor just might be the go-to language for most macros from now on, though I'll need more time with Razor to know for sure.</p>

<h2>My first Razor project, RazorSearch</h2>
<p>As a first project I'm writing RazorSearch for Umbraco. Basically, I'm recreating the functionality of XSLTsearch by implementing it with Razor.</p>

<p>As some of you may know, XSLTsearch was originally written in Notepad. I don't want to repeat that terrible editing and debugging experience. I'd like to use something more helpful as I learn Razor.</p>

<h2>Visual Studio and (no) Intellisense</h2>
<p>I fired up Visual Studio 2010 Professional, opened my local website, and was hoping for a lot of intellisense magic to give me hints along the way.</p>

<p>But no.</p>

<p>Intellisense was missing for @Model. I (and a lot of other early adopters on twitter) wanted some helps. How can I get some intellisense love with dynamic objects that are not determined until runtime?</p>

<h2>Make Intellisense and Debugging Work</h2>
<p>Being easier to show you how to do it than write about it, here's a short video that demonstrates how to get as much Razor Intellisense for Umbraco 4.7 (RC) macros as I've been able to come up with so far.<p>

<p>As an added bonus, I also show how easy it is to debug Razor macros without having to compile the source. It's really easy!</p>

<iframe title="YouTube video player" width="435" height="275" src="http://www.youtube.com/embed/NgnKy-VTimU?rel=0" frameborder="0" allowfullscreen></iframe>

<p><a href="http://www.youtube.com/watch?v=NgnKy-VTimU&hd=1">Watch on YouTube</a></p>


<h2>Helpful Resources</h2>
<p>As you begin your Razor macro journey, you may find the following resources helpful. I sure have!</p>
<ul>

<li><a href="http://our.umbraco.org/wiki/reference/code-snippets/razor-snippets/dynamicnode-%28and-model%29-members-and-properties">@Model's (DynamicNode and DynamicNodeLis) Properties and Methods Reference</a></li>

<li><a href="http://our.umbraco.org/wiki/reference/code-snippets/razor-snippets">http://our.umbraco.org/wiki/reference/code-snippets/razor-snippets</a></li>

<li><a href="http://umbraco.com/follow-us/blog-archive/2011/3/13/umbraco-razor-feature-walkthrough-part-5">Razor feature walkthrough (part 5)</a></li>

<li><a href="http://umbraco.com/follow-us/blog-archive/2011/3/1/umbraco-razor-feature-walkthrough-%E2%80%93-part-4">Razor feature walkthrough (part 4)</a></li>

<li><a href="http://umbraco.com/follow-us/blog-archive/2011/2/28/umbraco-razor-feature-walkthrough-%E2%80%93-part-3">Razor feature walkthrough (part 3)</a></li>

<li><a href="http://umbraco.com/follow-us/blog-archive/2011/2/24/umbraco-47-razor-feature-walkthrough---part-2">Razor feature walkthrough (part 2)</a></li>

<li><a href="http://umbraco.com/follow-us/blog-archive/2011/2/23/umbraco-47-razor-feature-walkthrough---part-1">Razor feature walkthrough (part 1)</a></li>


<li><a href="http://haacked.com/archive/2011/01/06/razor-syntax-quick-reference.aspx">Razor Syntax Quick Reference</a></li>

<li><a href="http://www.mikesdotnetting.com/Article/153/Inline-Razor-Syntax-Overview">Inline Razor Syntax Overview</a></li>

<li><a href="http://weblogs.asp.net/scottgu/archive/2010/07/02/introducing-razor.aspx">Introducing "Razor" - a new view engine for ASP.NET</a></li>

</ul>
]]></content:encoded></item><item><title>Quick and easy multi-lingual search pages for Umbraco sites</title><link>http://blog.percipientstudios.com/2010/11/17/quick-and-easy-multi-lingual-search-pages-for-umbraco-sites.aspx</link><pubDate>Wed, 17 Nov 2010 14:14:24 GMT</pubDate><guid>http://blog.percipientstudios.com/2010/11/17/quick-and-easy-multi-lingual-search-pages-for-umbraco-sites.aspx</guid><description>
&lt;p&gt;Searching within multi-lingual websites is simple with
XSLTsearch 3. Using Umbraco's convenient dictionary items and
language/culture capabilities you'll have multi-site,
multi-language searching in minutes.&lt;/p&gt;

&lt;p&gt;Here's a primer and &quot;how to&quot; guide to quickly set up XSLTsearch
in your multi-lingual website.&lt;/p&gt;
</description><author>info@percipientstudios.com (Douglas Robar)</author><content:encoded><![CDATA[ <p>Searching within multi-lingual websites is simple with
XSLTsearch 3. Using Umbraco's convenient dictionary items and
language/culture facility you'll have multi-site, multi-language
searching in minutes.</p>

<p>If you've never used the Umbraco dictionary capability before,
here's a primer and "how to" guide to quickly set up XSLTsearch in
your multi-lingual website. We'll cover the basics briefly and
focus on how to use XSLTsearch in an Umbraco installation with
multiple language sites.</p>

<p><em>You can find a more complete discussion of how to set up
multi-lingual websites in the umbraco.tv episodes about</em> <a
href="http://umbraco.tv/help-and-support/video-tutorials/umbraco-fundamentals/running-multiple-sites">
<em>Running Multiple Sites</em></a><em>.</em></p>

<p>&nbsp;</p>

<h2>Install XSLTsearch</h2>

<p>Install XSLTsearch from the Umbraco Package Repository, or by
first downloading it from <a
href="http://our.umbraco.org/website-utilities/xsltsearch">http://our.umbraco.org/website-utilities/xsltsearch</a>.</p>

<p><a
href="http://blog.percipientstudios.com/media/5406/WindowsLiveWriter_e124bd42ab2d_C0D0_install%20local%20package_2.png">
<img
style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px"
 title="install local package" border="0"
alt="install local package"
src="http://blog.percipientstudios.com/media/5411/WindowsLiveWriter_e124bd42ab2d_C0D0_install%20local%20package_thumb.png"
 width="277" height="390" /></a></p>

<p>&nbsp;</p>

<h2>Umbraco configuration steps</h2>

<h3>Add languages for your Umbraco installation</h3>

<p>Once XSLTsearch is installed, go to the Settings section of the
Umbraco back office administration interface, and expand the
Languages area. Here you'll see all the languages that your sites
will be able to use.</p>

<p>If your sites will need a language that isn't yet listed,
right-click on the Languages item and create a new language.</p>

<p><a
href="http://blog.percipientstudios.com/media/5416/WindowsLiveWriter_e124bd42ab2d_C0D0_languages-create_2.png">
<img
style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px"
 title="Create additional languages" border="0"
alt="Create additional languages"
src="http://blog.percipientstudios.com/media/5421/WindowsLiveWriter_e124bd42ab2d_C0D0_languages-create_thumb.png"
 width="277" height="234" /></a></p>

<p>Let's suppose we want to add German (as spoken in Germany) as a
language for one of our sites. Select "German (Germany)" from the
exhaustive list of languages and cultures:</p>

<p><a
href="http://blog.percipientstudios.com/media/5426/WindowsLiveWriter_e124bd42ab2d_C0D0_languages-german_2.png">
<img
style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px"
 title="Select your chosen language from the dropdown list"
border="0" alt="Select your chosen language from the dropdown list"
src="http://blog.percipientstudios.com/media/5431/WindowsLiveWriter_e124bd42ab2d_C0D0_languages-german_thumb.png"
 width="435" height="453" /></a>&nbsp;</p>

<p>We now have two languages available for use in our site, English
(United States) and German (Germany).</p>

<p><a
href="http://blog.percipientstudios.com/media/5436/WindowsLiveWriter_e124bd42ab2d_C0D0_languages-2langs_2.png">
<img
style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px"
 title="Umbraco shows the languages you have configured" border="0"
alt="Umbraco shows the languages you have configured"
src="http://blog.percipientstudios.com/media/5441/WindowsLiveWriter_e124bd42ab2d_C0D0_languages-2langs_thumb.png"
 width="276" height="234" /></a></p>

<p>You can add as many languages for as many sites in Umbraco as
you need following this same procedure.</p>

<h3>Create multiple sites in Umbraco</h3>

<p>It is best-practice to nest all your site's content beneath a
homepage. The wisdom of this practice is revealed when you want to
add another site to your Umbraco installation, as we will do
here.</p>

<p>For instance, you might have your public website, intranet, and
blog all in one Umbraco installation. Or perhaps you need to
present one site in a lot of different languages. Or even a
combination of both.</p>

<p>I'm going to assume you've got two sites set up similarly to
that shown below, two sites with one for each language. For
convenience, I have named each homepage with the two-letter culture
code (EN and DE).</p>

<p><a
href="http://blog.percipientstudios.com/media/5446/WindowsLiveWriter_e124bd42ab2d_C0D0_two-sites_2.png">
<img
style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px"
 title="Content structure showing two sites" border="0"
alt="Content structure showing two sites"
src="http://blog.percipientstudios.com/media/5451/WindowsLiveWriter_e124bd42ab2d_C0D0_two-sites_thumb.png"
 width="277" height="113" /></a></p>

<h3>Assign hostname, language, culture to each site</h3>

<p>Now that you have two sites, you need to tell Umbraco which site
is associated with each language. This is a simple point-n-click
operation.</p>

<p>Right-click the homepage for one of the sites and select the
'Manage hostnames' menu. In the window that appears, assign a
domain for this site and select the appropriate language.</p>

<p><a
href="http://blog.percipientstudios.com/media/5456/WindowsLiveWriter_e124bd42ab2d_C0D0_manage-hostnames_2.png">
<img
style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px"
 title="Manage hostnames to assign domain and language for a site"
border="0"
alt="Manage hostnames to assign domain and language for a site"
src="http://blog.percipientstudios.com/media/5461/WindowsLiveWriter_e124bd42ab2d_C0D0_manage-hostnames_thumb.png"
 width="435" height="234" /></a></p>

<p>Repeat for all sites.</p>

<p>You can find lots of forum posts about using separate domains or
a single domain and folders to distinguish one site from another
via the URL. Depending on your preferred URL you'll end up changing
either the&nbsp; umbracoHideTopLevelNodeFromPath (in web.config
file) or useDomainPrefixes (in /config/umbracoSettings.config). The
combination of these settings will effect the URL for the pages in
each site, but is beyond the scope of this article.</p>

<p>&nbsp;</p>

<h2>And now, back to XSLTsearch</h2>

<p><em>If using XSLTsearch 3.0, you should modify it as noted <a
href="http://blog.percipientstudios.com/2010/11/11/user-modification-to-xsltsearch-for-easier-multi-site-searching.aspx">
here</a>. This will be the default behavior for future versions of
XSLTsearch. This step is only necessary for v3.0.</em></p>

<h3>Create a search page for each site</h3>

<p>Now create a search page for each site. Right-click on the home
page of each site and select the Create menu. Name the page and
select the XSLTsearch document type.</p>

<p>Your content tree will now look similar to this, with a search
page in each site.</p>

<p><a
href="http://blog.percipientstudios.com/media/5466/WindowsLiveWriter_e124bd42ab2d_C0D0_xsltsearch-content-tree_2.png">
<img
style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px"
 title="XSLTsearch search pages in multiple Umbraco sites"
border="0" alt="XSLTsearch search pages in multiple Umbraco sites"
src="http://blog.percipientstudios.com/media/5471/WindowsLiveWriter_e124bd42ab2d_C0D0_xsltsearch-content-tree_thumb.png"
 width="211" height="345" /></a></p>

<h3>Translate the XSLTsearch dictionary keys for each language</h3>

<p>At this point, your search will work properly in all sites but
all the static text on the search page will be in English, which
isn't what we want.</p>

<p>The last step is to translate the XSLTsearch dictionary items
into the languages of your site.</p>

<p><em>You may notice that I don't speak German. I've used
Microsoft Translate and Warren Buckley's handy <a
href="http://our.umbraco.org/projects/backoffice-extensions/dictionary-translator-for-umbraco">
Dictionary Translator for Umbraco</a>. <strong></strong>I hope you
can excuse any mistakes :)</em></p>

<p>In the Settings section of Umbraco's back office, expand the
Dictionary area. You will see a folder of terms used by XSLTsearch.
Select each dictionary item in turn, entering the appropriate
translation for each language of your site. If you leave any blank
the default English term will be used in its place so at least your
site will have text for everything, albeit in English..</p>

<p><a
href="http://blog.percipientstudios.com/media/5476/WindowsLiveWriter_e124bd42ab2d_C0D0_xsltsearch-dictionary_2.png">
<img
style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px"
 title="XSLTsearch dictionary keys" border="0"
alt="XSLTsearch dictionary keys"
src="http://blog.percipientstudios.com/media/5481/WindowsLiveWriter_e124bd42ab2d_C0D0_xsltsearch-dictionary_thumb.png"
 width="435" height="242" /></a></p>

<p>&nbsp;</p>

<h2>Go forth and search!</h2>

<p>That's all there is to it. All the setup work is now complete
and you're ready to enjoy localized search pages across all the
languages of your site. If you later add another language site all
you'll need to do is create an XSLTsearch page in the new site and
translate the dictionary keys into the new site's language. It
couldn't be easier.</p>

<p>Here's what the finished result looks like, with example search
pages in both English and German:</p>

<h3>An English search page</h3>

<p><a
href="http://blog.percipientstudios.com/media/5486/WindowsLiveWriter_e124bd42ab2d_C0D0_xsltsearch-results-english_2.png">
<img
style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px"
 title="Search results in English" border="0"
alt="Search results in English"
src="http://blog.percipientstudios.com/media/5491/WindowsLiveWriter_e124bd42ab2d_C0D0_xsltsearch-results-english_thumb.png"
 width="350" height="418" /></a></p>

<h3>A German search page&nbsp;</h3>

<p><a
href="http://blog.percipientstudios.com/media/5496/WindowsLiveWriter_e124bd42ab2d_C0D0_xsltsearch-results-german_4.png">
<img
style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px"
 title="Search results in German" border="0"
alt="Search results in German"
src="http://blog.percipientstudios.com/media/5501/WindowsLiveWriter_e124bd42ab2d_C0D0_xsltsearch-results-german_thumb_1.png"
 width="356" height="435" /></a></p>
]]></content:encoded></item><item><title>Make an App_Code XSLT extension for Umbraco</title><link>http://blog.percipientstudios.com/2010/11/12/make-an-app_code-xslt-extension-for-umbraco.aspx</link><pubDate>Fri, 12 Nov 2010 10:02:37 GMT</pubDate><guid>http://blog.percipientstudios.com/2010/11/12/make-an-app_code-xslt-extension-for-umbraco.aspx</guid><description>
&lt;p&gt;New to Umbraco 4.5, XSLT extensions in the /App_Code folder
provides code that is right in front of you and easy to edit (even
for non-&quot;VisualStudio junkies&quot;). App_Code XSLT extensions are
strongly-defined (safer), cached-at-application-level (faster), and
medium-trust-capable (cheaper hosting). Wow!&lt;/p&gt;

&lt;p&gt;And they are so easy to make! Let me show you how.&lt;/p&gt;
</description><author>info@percipientstudios.com (Douglas Robar)</author><content:encoded><![CDATA[ <p>You may have noticed that XSLTsearch 3.0 moved all the C# helper
functions from in-line scripting within the XSLT file itself to
/app_code/xsltsearch.cs. The reasons for doing this and how to
create XSLT extensions without Visual Studio are the subject of
this article.</p>

<p>What is the App_Code folder you ask? As Microsoft puts it, "you
can store source code in the App_Code folder, and it will be
automatically compiled at run time. The resulting assembly is
accessible to any other code in the Web application. The App_Code
folder therefore works much like the Bin folder, except that you
can store source code in it instead of compiled code.</p>

<p>&nbsp;</p>

<h2>Extending XSLT's capabilities</h2>

<h3>Compiled XSLT extensions</h3>

<p>In the past, when you wanted to add a little extra oomph to your
XSLT macro you probably would have created an XSLT extension in
Visual Studio, compiled it to a dll, copied it to the /bin folder
of your site, and referenced it by updating the
/config/XSLTextensions.config file.</p>

<p>Simple, no?</p>

<p>Well, to be honest, sometimes it does seem a bit over the top
for just a few lines of .Net code. Especially if you aren't a .Net
Jedi™.</p>

<h3>What's wrong with &lt;msxml:script&gt; blocks?</h3>

<p>The other option in such a case is to place your .Net code in an
&lt;msxml:script&gt; block directly in your xslt file. I've found
this to be a powerful and easy-to-implement solution. Indeed, all
versions prior to XSLTsearch 3.0 used this technique as well.</p>

<p>There are down-sides to inline script blocks, though. For one
thing, the macro will compile itself every single time the macro is
run. That doesn't take long, but it adds up. Worse, you'll find a
lot of tiny files from those compilations cluttering your system
TEMP folder. This is especially evident if you haven't disabled
debugging in the web.config file. These are small files but on a
busy site they add up quickly and could potentially fill your
system drive. And because the system TEMP folder is outside your
website your macro won't run in medium trust.</p>

<p>Benjamin Howarth (<a
href="http://twitter.com/#!/benjaminhowarth/">@benjaminhowarth</a>)
discussed these and more in his illuminating presentation at the
Umbraco 5th Birthday party in London, <a
href="http://www.slideshare.net/warrenbuckley/umbraco-medium-trust">
Medium Trust for Umbraco 4.x</a>.</p>

<p>I still like the benefits of inline scripting:&nbsp; all code is
available for easy inspection, learning, and editing, and you never
have to fire up Visual Studio ("oh, that project was created with
VS 2005 and I only have VS 2099… hmmmm"). On the other hand, the
downsides of not creating a proper XSLT extension are fairly
significant.</p>

<h3>Welcome to App_Code XSLT extensions in Umbraco</h3>

<p>New to Umbraco 4.5, XSLT extensions in the /App_Code folder
provides the best of both worlds! Code that is right in front of
you and easy to edit, even for non-"VisualStudio junkies". And, you
get strongly-defined (safer), cached-at-application-level (faster),
and medium-trust-support (cheaper hosting). Wow!</p>

<p>And it is so easy to do! Let me show you how.</p>

<p>&nbsp;</p>

<h2>Reworking an old example</h2>

<p>I'm going to re-work an older post entitled, <a
href="http://blog.percipientstudios.com/2009/9/21/advanced-xslt-with-net-namespaces.aspx">Advanced
XSLT with .NET Namespaces</a>. You might want to read that article
if the following code doesn't make sense to you.</p>

<p>In that older article I used an inline script block to determine
the size of an uploaded file. This is something that can't be done
from XSLT alone so I added the following C# script block. Let's
remove the code from the script block and put it in an App_Code
extension.</p>

<div
style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px"
 id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:49eb05df-e1a6-4a72-9962-ddb57ea46541"
 class="wlWriterEditableSmartContent">
<pre class="brush: xml;">
&lt;msxml:script language="CSharp" implements-prefix="ps"&gt;
    &lt;msxml:using namespace="System.IO" /&gt;
    &lt;msxml:assembly name="System.Web" /&gt;
    &lt;msxml:using namespace="System.Web" /&gt;
 
    &lt;![CDATA[
    public String uploadFileSize(String filePath) {
 
        if ((filePath != null) &amp;&amp; (filePath.Length != 0)) {
            String localFile = HttpContext.Current.Server.MapPath(filePath);
            if (File.Exists(localFile)) {
                FileInfo fileinfo = new FileInfo(localFile);
                return String.Format("{0:#,###,###.##}", (fileinfo.Length / 1024));
            }
        }
        return null;
    }
    ]]&gt;
&lt;/msxml:script&gt;
</pre>
</div>

<h3>1. Create a file in the /app_code folder</h3>

<p>All we have to do to convert this script block to a proper XSLT
extension is create a file in the /app_code folder of my site. I'll
call it PShelpers.cs. You can create these App_Code XSLT extensions
with Notepad, Visual Studio (tip: create a 'Class Library'
project), or anything in between.</p>

<p>Your baseline, starting file should look like this:</p>

<div
style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px"
 id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:45012317-d38d-4e75-8821-2877a46cac94"
 class="wlWriterEditableSmartContent">
<pre class="brush: c#;">
using System;
using System.Collections;

namespace ClassLibrary
{
    public class Class1
    {
    }
}
</pre>
</div>

<h3>2. Name your class and namespace, add references</h3>

<p>Now, change the namespace and class names for your project, add
the umbraco api reference and any other namespaces you might
need:</p>

<div
style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px"
 id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:ff406990-91a9-4433-a0f0-d241dfc90a6d"
 class="wlWriterEditableSmartContent">
<pre class="brush: c#;">
using System;
using System.Collections;
using System.IO;
using System.Web;
using umbraco;

namespace PS
{
    public class Helpers
    {

    }
}
</pre>
</div>

<h3>3. Add [XsltExtension] and zero-parameter constructor</h3>

<p>Add the <strong>[XsltExtension]</strong> line to the namespace
and create a a <strong>zero-parameter constructor</strong> so that
Umbraco will automatically pick this up as an XSLT extension:</p>

<div
style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px"
 id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:7e53f709-3913-435e-a275-c822d46ad448"
 class="wlWriterEditableSmartContent">
<pre class="brush: c#;">
using System;
using System.Collections;
using System.IO;
using System.Web;
using umbraco;

namespace PS
{
    [XsltExtension]

    public class Helpers
    {
        public Helpers() { }
    }
}
</pre>
</div>

<h3>4. Paste the code from your script block</h3>

<p>Now all you do is copy-n-paste the code from your script
block.</p>

<p>Remember, all your <strong>functions must be public
static</strong>.</p>

<p>Here's the final version of our re-worked example, this time as
an App_Code XSLT extension:</p>

<div
style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px"
 id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:ab2b0ecd-d8d2-4062-8541-1e955605f478"
 class="wlWriterEditableSmartContent">
<pre class="brush: c#;">
using System;
using System.Collections;
using System.IO;
using System.Web;
using umbraco;

namespace ps
{
    [XsltExtension]

    public class Helpers
    {
        public Helpers() { }

        public static String uploadFileSize(String filePath)
        {

            if ((filePath != null) &amp;&amp; (filePath.Length != 0))
            {
                String localFile = HttpContext.Current.Server.MapPath(filePath);
                if (File.Exists(localFile))
                {
                    FileInfo fileinfo = new FileInfo(localFile);
                    return String.Format("{0:#,###,###.##}", (fileinfo.Length / 1024));
                }
            }
            return null;
        }

    }
}
</pre>
</div>

<p>&nbsp;</p>

<h2>Using your XSLT extension</h2>

<p>Now that you have a functioning XSLT extension you can remove
the msxml:script from your xslt file and update the references to
the new namespace and class. In our example, from 'ps' to
'PS.Helpers'. The macro will work as before, only in medium-trust
and with better performance.</p>

<p>Additionally, when you create a new macro in Umbraco your
App_Code XSLT extension will automatically be referenced. And when
you click the '<strong>Insert xsl:value-of</strong>' toolbar button
in Umbraco's XSLT editor you can select your App_Code XSLT
extension for point-n-click simplicity.</p>

<p><a
href="http://blog.percipientstudios.com/media/5377/WindowsLiveWriter_MakeanUmbracoXSLTextensioninApp_Code_D396_ps.helpers%20xslt%20extension%20get%20extension_2.png">
<img
style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px"
 title="Insert Value in XSLT dialog box" border="0"
alt="Insert Value in XSLT dialog box"
src="http://blog.percipientstudios.com/media/5382/WindowsLiveWriter_MakeanUmbracoXSLTextensioninApp_Code_D396_ps.helpers%20xslt%20extension%20get%20extension_thumb.png"
 width="435" height="149" /></a>&nbsp;</p>

<p><a
href="http://blog.percipientstudios.com/media/5387/WindowsLiveWriter_MakeanUmbracoXSLTextensioninApp_Code_D396_ps.helpers%20xslt%20extension%20insert%20value_2.png">
<img
style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px"
 title="Select your extension and functions" border="0"
alt="Select your extension and functions"
src="http://blog.percipientstudios.com/media/5392/WindowsLiveWriter_MakeanUmbracoXSLTextensioninApp_Code_D396_ps.helpers%20xslt%20extension%20insert%20value_thumb.png"
 width="435" height="149" /></a></p>

<p>&nbsp;</p>

<h2>"Gotcha" - only one language in App_Code</h2>

<p>An important point to mention is that all the files in App_Code
must use the same .Net language. You cannot mix C# for some files
and VB.net for others, for instance. However, there is a <a
href="http://msdn.microsoft.com/en-us/library/t990ks23.aspx">solution</a>
if you must mix languages in the /app_code folder.</p>

<h2>"Gotcha" again - App_Code bugs give YSOD</h2>

<p>Never edit anything in the App_Code folder on a live site. If
you make a mistake the site may display a Yellow Screen of Death
(YSOD). In some cases even the Umbraco back end won't respond
properly, or the site's application pool may shut down after
repeated errors. You've been warned and I take no responsibility.
Okay? Okay. But… if you are careful with your code (as of course
you will be) then app_code is no more dangerous than a dll.</p>
]]></content:encoded></item><item><title>User modification to XSLTsearch for easier multi-site searching</title><link>http://blog.percipientstudios.com/2010/11/11/user-modification-to-xsltsearch-for-easier-multi-site-searching.aspx</link><pubDate>Thu, 11 Nov 2010 10:59:33 GMT</pubDate><guid>http://blog.percipientstudios.com/2010/11/11/user-modification-to-xsltsearch-for-easier-multi-site-searching.aspx</guid><description>
&lt;p&gt;Sebastiaan Janssen (&lt;a
href=&quot;http://twitter.com/#%21/cultiv&quot;&gt;@cultiv&lt;/a&gt;) mentioned a nice
modification he makes to XSLTsearch on the &lt;a
href=&quot;http://our.umbraco.org/forum/core/general/14483-Multi-website-Single-Solution-Site-Specific-Search-without-visible-prefix&quot;&gt;
our.umbraco forum&lt;/a&gt; today, simplifying its use in multi-lingual
websites. It is so useful and simple I thought I would explain it
in detail.&lt;/p&gt;
</description><author>info@percipientstudios.com (Douglas Robar)</author><content:encoded><![CDATA[ <p>Sebastiaan Janssen (<a
href="http://twitter.com/#!/cultiv">@cultiv</a>) mentioned a nice
modification he makes to XSLTsearch on the <a
href="http://our.umbraco.org/forum/core/general/14483-Multi-website-Single-Solution-Site-Specific-Search-without-visible-prefix">
our.umbraco forum</a> today, simplifying its use in multi-lingual
websites. It is so useful and simple I thought I would explain it
in detail.</p>

<p>XSLTsearch 3.0 uses Umbraco dictionary keys to translate the
various bits of text that appear on the search page. The same
search macro can be used everywhere on your site and will display
in the site's language and culture.</p>

<p>You can either search all pages or specify the page to begin
searching beneath (the 'source' parameter in the XSLTsearch macro).
If you have multiple websites within one Umbraco installation you
can make a small change to XSLTsearch and each site will instantly
<strong>search only within its own pages</strong>.</p>

<p>Here's what a typical multi-site installation would look
like:</p>

<p><a
href="http://blog.percipientstudios.com/media/5352/WindowsLiveWriter_UsermodificationtoXSLTsearchforeasiermul_E0EC_XSLTsearch%20in%20multiple%20umbraco%20sites_2.png">
<img
 title="XSLTsearch in multiple umbraco sites" border="0"
alt="XSLTsearch in multiple umbraco sites"
src="http://blog.percipientstudios.com/media/5357/WindowsLiveWriter_UsermodificationtoXSLTsearchforeasiermul_E0EC_XSLTsearch%20in%20multiple%20umbraco%20sites_thumb.png"
 width="435" height="300" /></a></p>

<p>We'd rather not create multiple templates for XSLTsearch for
each site, nor insert the XSLTsearch macro in a richtext editor
page on each site, forcing editors to decide what to enter in each
of the macro properties.</p>

<p>Thankfully XSLTsearch is easy to modify to meet your needs. The
key, as Sebastiaan says, is to use the ancestor-or-self XPATH axis
to set the source used when searching. We want to use the top-most
page in whatever site is currently being viewed. That is, to the
page that is at the first level in the content tree.</p>

<p>By default, XSLTsearch will search all pages if you don't tell
it otherwise.</p>

<div
style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px"
 id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:7cf33a38-d89c-44d1-a90e-c5c70766b253"
 class="wlWriterEditableSmartContent">
<pre class="brush: xml;">
&lt;xsl:call-template name="search"&gt;
  &lt;xsl:with-param name="items" select="umbraco.library:GetXmlAll()/*"/&gt;
&lt;/xsl:call-template&gt;
</pre>
</div>

<p>&nbsp;</p>

<p>What we want to do is change the default behavior to this:</p>

<div
style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px"
 id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:d1d22a54-2cc7-4596-879b-39941a6d3dd2"
 class="wlWriterEditableSmartContent">
<pre class="brush: xml;">

&lt;xsl:call-template name="search"&gt;
  &lt;xsl:with-param name="items" select="$currentPage/ancestor-or-self::*[@level = '1']"/&gt;
&lt;/xsl:call-template&gt;
</pre>
</div>

<p>&nbsp;</p>

<p>That's all there is to it! Thanks for the tip, Sebastiaan!</p>
]]></content:encoded></item><item><title>XSLTsearch 3.0 released</title><link>http://blog.percipientstudios.com/2010/11/11/xsltsearch-30-released.aspx</link><pubDate>Thu, 11 Nov 2010 10:29:58 GMT</pubDate><guid>http://blog.percipientstudios.com/2010/11/11/xsltsearch-30-released.aspx</guid><description>
&lt;p&gt;XSLTsearch just got a major update to better support
Umbraco&lt;br /&gt;
 4.5! Instant multi-lingual search pages, medium-trust support,
improved performance, and many important bug fixes.&lt;/p&gt;
</description><author>info@percipientstudios.com (Douglas Robar)</author><content:encoded><![CDATA[ <h2>About XSLTsearch</h2>

<p>XSLTsearch just got a major update to better support Umbraco
4.5!</p>

<p>XSLTsearch is the easy, quick, and free search solution for
Umbraco web sites. It is fast, completely self-contained, and
extremely configurable.</p>

<p>With XSLTsearch you can search for all words and phrases in all
document properties and attributes, including your custom
properties. Search results are automatically sorted by relevance
with search terms highlighted in the results.</p>

<p>Member-protected and hidden content is not returned in search
results, ensuring private information remains private.</p>

<p>XSLTsearch installs in all Umbraco sites, with or without Runway
installed.</p>

<p>&nbsp;</p>

<h2>Improvements in 3.0</h2>

<p>Improvements include:</p>

<ul>
<li>Instant support for <strong>Multi-Lingual</strong> websites
with dictionary keys</li>

<li>Support for <strong>medium trust</strong></li>

<li style="list-style: none">
<ul>
<li>helper functions are now in /app_code/xsltsearch.cs</li>
</ul>
</li>

<li><strong>Performance</strong> improvements</li>

<li>Many <strong>bug fixes</strong>, including:</li>

<li style="list-style: none">
<ul>
<li>Multi-word searches now return proper results</li>

<li>Searching for the letter "s" no longer breaks html markup in
results</li>

<li>Contextual results display improved in many cases<br />
</li>
</ul>
</li>
</ul>

<h2>Get XSLTsearch</h2>

<p><strong>Download</strong> XSLTsearch and the full documentation
from: <a
title="http://our.umbraco.org/projects/website-utilities/xsltsearch"
 href="http://our.umbraco.org/projects/website-utilities/xsltsearch">
http://our.umbraco.org/projects/website-utilities/xsltsearch</a>
(primary)<br />
<a
href="http://www.percipientstudios.com/xsltsearch/download.aspx">http://www.percipientstudios.com/xsltsearch/download.aspx</a></p>
]]></content:encoded></item><item><title>XSLTsearch supports Umbraco 4.1</title><link>http://blog.percipientstudios.com/2010/6/15/xsltsearch-supports-umbraco-41.aspx</link><pubDate>Tue, 15 Jun 2010 12:01:54 GMT</pubDate><guid>http://blog.percipientstudios.com/2010/6/15/xsltsearch-supports-umbraco-41.aspx</guid><description>
&lt;p&gt;Coinciding with the release of Umbraco 4.1RC, we have updated
XSLTsearch to work perfectly with the new xml schema. Download
XSLTsearch 2.8.1 today!&lt;/p&gt;
</description><author>info@percipientstudios.com (Douglas Robar)</author><content:encoded><![CDATA[ <p>Coinciding with the release of <a href="http://umbraco.org/blog/2010/6/15/umbraco-41rc-is-out">Umbraco 4.1RC</a>, we have updated <a href="http://www.percipientstudios.com/xsltsearch.aspx">XSLTsearch</a> to work perfectly with the new xml schema.</p>
<p><strong>XSLTsearch 2.8.1 is now available for download at<br /><a href="http://our.umbraco.org/projects/xsltsearch">http://our.umbraco.org/projects/xsltsearch</a></strong></p>
<p>Please continue to use XSLTsearch 2.8 for Umbraco 3.x, 4.0, and 4.1 sites with the legacy xml schema enabled.</p>
<p>&nbsp;</p>
<p>cheers,<br />doug.</p>]]></content:encoded></item><item><title>The never-expiring copyright date</title><link>http://blog.percipientstudios.com/2010/1/2/the-never-expiring-copyright-date.aspx</link><pubDate>Sat, 02 Jan 2010 18:28:19 GMT</pubDate><guid>http://blog.percipientstudios.com/2010/1/2/the-never-expiring-copyright-date.aspx</guid><description>
&lt;p&gt;It's January 2... do you know if your site's copyright notice is
up-to-date?&lt;/p&gt;

&lt;p&gt;With a quick bit of inline XSLT in your umbraco template you
need never worry about it again!&lt;/p&gt;
</description><author>info@percipientstudios.com (Douglas Robar)</author><content:encoded><![CDATA[ <p>It's January 2... do you know if your site's copyright notice is up-to-date?</p>

<p>With a quick bit of <a href="http://our.umbraco.org/wiki/reference/templates/umbracoitem-element/inline-xslt/how-to-use-it" target="_blank">inline XSLT</a> in your umbraco template you need never worry about it again!</p>
<p>Here's how to do it:</p>

<pre class="brush: xml;">
&lt;div id="footer"&gt;
    COPYRIGHT &amp;copy; 2009 - 
    &lt;umbraco:Item field="pageName" runat="server" xslt="Exslt.ExsltDatesAndTimes:year()" /&gt;, 
    PERCIPIENT STUDIOS. ALL RIGHTS RESERVED.
&lt;/div&gt;
</pre>

<p>There are three points you'll want to keep in mind:
<ul>
<li>You must not omit the field="" parameter.</li>
<li>You must select a field="" that actually exists.<br />This is why I used the "pageName" field.</li>
<li>You can select any field="" you want.<br />Remember that the xslt="" command will process the field="" parameter passed in before displaying the output; and in our example the xslt ignores the field being passed in.</li>
</ul>
</p>

<h2>Alternatives</h2>
<p>Or, if you have some objection to the Exslt extension and want to use only the umbraco library, you can achieve the same result with:
</p>
<pre class="brush: xml;">
    &lt;umbraco:Item field="pageName" runat="server" xslt="umbraco.library:FormatDateTime(umbraco.library:CurrentDate(), 'yyyy')" /&gt;,
</pre>

<p>Or, if you really want to use a full macro, it would look like this:</p>
<pre class="brush: xml;">
&lt;xsl:template match="/"&gt;
    &lt;xsl:value-of select="Exslt.ExsltDatesAndTimes:year()" /&gt;
&lt;/xsl:template&gt;
</pre>

<p>[EDIT] Or, as Casey points out in the comments... if you have a deep love for all things .NET (or aren't a fan of XSLT) you could put this in your template instead of the umbraco:Item:</p>
<pre class="brush: csharp;">
    &lt;%= DateTime.Now.Year %&gt;
</pre>

<h2>Conclusion</h2>
<p>You can now sleep through New Year's day comfortably, thanks to umbraco and XSLT.</p>
<p>Happy New Year!<br />doug.</p>]]></content:encoded></item><item><title>Advanced XSLT with .NET Namespaces</title><link>http://blog.percipientstudios.com/2009/9/21/advanced-xslt-with-net-namespaces.aspx</link><pubDate>Mon, 21 Sep 2009 12:54:33 GMT</pubDate><guid>http://blog.percipientstudios.com/2009/9/21/advanced-xslt-with-net-namespaces.aspx</guid><description>
&lt;p&gt;Extending your umbraco XSLT macros to access .NET namespaces is
very simple and will help you make the most of your macros. An
example of file-level access from an XSLT macro is provided.&lt;/p&gt;
</description><author>info@percipientstudios.com (Douglas Robar)</author><content:encoded><![CDATA[ <p>I prefer to use XSLT macros whenever possible, resorting to C#
only when I absolutely have to.</p>

<p>Until recently I have created .net macros for even simple
functionality that I would have preferred to put in an
easily-maintained XSLT macro. Why? Because I couldn't access a
needed namespace from within XSLT.</p>

<h2>An example: file level operations</h2>

<p>A recent site I worked on needed to display the size of a file.
If the file were in umbraco's Media section this would be easy with
the built-in <strong>umbracoBytes</strong> property. But in this
case, the file was uploaded rather than placed in umbraco's Media
section. Thus, the usual umbraco metadata was not available.</p>

<p>Various solutions presented themselves:</p>

<ul>
<li>Add an <strong>'umbracoBytes' property</strong> (of type label
or static text) to my document type. Umbraco will auto-populate this
property when a file is uploaded (this is VERY cool and a great tip
to remember!). In my case, however, I had four upload fields in
the docType and whatever file was uploaded last would have its
filesize placed in the 'umbracoBytes' field. I needed a solution
that would work for all the files uploaded.</li>

<li>Create an <strong>event handler</strong> setting a unique
uploadFile1_umbracoBytes, uploadFile2_umbracoBytes, etc. property
when uploading the file. This seemed like too much effort and I
would be sure to forget to update the event handler should a fifth
upload field be added to the docType later on.</li>

<li>Create a <strong>custom XSLT extension</strong> to get the
filesize information. This is a good solution but a whole extension
seemed rather over-kill for a few lines of C# code.</li>
</ul>

<p>The C# function I wanted to use was very simple, taking the path
to a file and returning the filesize in kilobytes. This could
certainly be done as an XSLT extension:</p>

<pre class="brush: csharp; gutter: false;">
public String uploadFileSize(String filePath) {

    if ((filePath != null) &amp;&amp; (filePath.Length != 0)) {
        String localFile = HttpContext.Current.Server.MapPath(filePath);
        if (File.Exists(localFile)) {
            FileInfo fileinfo = new FileInfo(localFile);
            return String.Format("{0:#,###,###.##}", (fileinfo.Length / 1024));
        }
    }
    return null;
}
</pre>

<h2>Using .NET namespaces in your XSLT macros</h2>

<p>What I really wanted to do was augment my XSLT macro with that
bit of C# code to get the file size from within the XSLT file
itself, without needing to create a .NET control, some app_code, an
event handler, or custom XSLT extension.</p>

<p>Unfortunately, file level access and many other fun capabilities
are not allowed in your umbraco XSLT macros. Not by default, that
is. But it's really simple to add that ability with in-line C# (a
topic we'll cover in another post) in your XSLT macro.</p>

<pre class="brush: csharp; gutter: false;">
&lt;msxml:script language="CSharp" implements-prefix="ps"&gt;
    &lt;msxml:using namespace="System.IO" /&gt;
    &lt;msxml:assembly name="System.Web" /&gt;
    &lt;msxml:using namespace="System.Web" /&gt;

    &lt;![CDATA[
    public String uploadFileSize(String filePath) {

        if ((filePath != null) &amp;&amp; (filePath.Length != 0)) {
            String localFile = HttpContext.Current.Server.MapPath(filePath);
            if (File.Exists(localFile)) {
                FileInfo fileinfo = new FileInfo(localFile);
                return String.Format("{0:#,###,###.##}", (fileinfo.Length / 1024));
            }
        }
        return null;
    }
    ]]&gt;
&lt;/msxml:script&gt;
</pre>

<p><br />
The <strong>msxml:using</strong> and
<strong>msxml:assembly</strong> statements are the important bits. The msxml:assembly loads the assembly like adding a reference in a .NET project. The msxml:using makes using the functions shorter with no prefix required, just as <strong>using
System.IO;</strong> and <strong>using System.Web;</strong> in your
C# code would do.</p>
<p>I found System.IO was already available so I didn't need to add the assembly statement for it. System.Web was not available so I added it with the msxml:assembly statement.</p>

<h2>Completed XSLT macro with in-line .NET code</h2>

<p>Here is a complete (and very simple, rather hard-coded) XSLT
file. Your macros would probably have more logic in the main
template, possibly set the uploadedFile variable with a macro
parameter (using a propertyPicker data type), and include
additional checks for errors.&nbsp;</p>

<pre class="brush: csharp; gutter: false;">
&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:ps="urn:schemas-percipient-studios"
    xmlns:umbraco.library="urn:umbraco.library"
    exclude-result-prefixes="msxml ps umbraco.library" &gt;

    &lt;xsl:output method="xml" omit-xml-declaration="yes" /&gt;

    &lt;xsl:param name="currentPage"/&gt;

    &lt;!-- =========================================================== --&gt;

    &lt;xsl:template match="/"&gt;
        &lt;xsl:variable name="uploadedFile" select="$currentPage/data[@alias='uploadedFile']" /&gt;
        &lt;xsl:if test="string($uploadedFile) != ''"&gt;
            &lt;p&gt;
                The size of the uploaded file is:
                &lt;xsl:value-of select="ps:uploadFileSize($uploadedFile)" /&gt; kb
            &lt;/p&gt;
        &lt;/xsl:if&gt;
    &lt;/xsl:template&gt;

    &lt;!-- =========================================================== --&gt;

    &lt;msxml:script language="CSharp" implements-prefix="ps"&gt;
        &lt;msxml:using namespace="System.IO" /&gt;
        &lt;msxml:assembly name="System.Web" /&gt;
        &lt;msxml:using namespace="System.Web" /&gt;

        &lt;![CDATA[
        public String uploadFileSize(String filePath) {

            if ((filePath != null) &amp;&amp; (filePath.Length != 0)) {
                String localFile = HttpContext.Current.Server.MapPath(filePath);
                if (File.Exists(localFile)) {
                    FileInfo fileinfo = new FileInfo(localFile);
                    return String.Format("{0:#,###,###.##}", (fileinfo.Length / 1024));
                }
            }
            return null;
        }
        ]]&gt;
    &lt;/msxml:script&gt;

    &lt;!-- =========================================================== --&gt;
                
&lt;/xsl:stylesheet&gt;
</pre>

<h2>Conclusion</h2>

<p>As you can see, extending your XSLT macros with a bit of .NET
functionality is very simple and will help you make the most of
your macros. And because XSLT macros are compiled, performance is
not a problem, though I also cached this macro heavily as well just to be on the safe side.</p>
]]></content:encoded></item></channel></rss>

