Monday 13 February 2012

Xslt Plugin for Windows Live Writer

A plugin for the Windows LIve Writer blogging software was developed. A simple but yet a very powerful plugin that can make your blog posts more pretty and customised to your liking. The Xslt plugin can transform your content data. The plugin offers the benefit of preparing an xslt template that can be reused, can have css formatting and can be applied to the matched xml content data.

You can load an xml with your content data and an xslt that will transform the xml data to a desired html content and be inserted into your blog post. You can use local xml files as your content data. You can also use any remote http web request that returns xml data, is publicly available and does not need any kind of authentication.

Click on the ellipsis button to select the xml file from your pc or insert the http request and click “Open”. In the latter case, windows will download the xml file into an internet temporary location. Then click on the ellipsis button to select the xslt file from your pc. Click the “Insert” button to insert the content into your blog post. Check the “Multiple” checkbox If you want multiple content added in the same smart content.

In the http request case you can use public rss feeds, the youtube data search API,  yahoo’s YQL or other ie. http://gdata.youtube.com/feeds/api/users/radiohead/uploads?orderby=updated&alt=rss

The xslt processor of the XsltPlugin supports embedded scripting out of the box and you can leverage xslt reusability through the use of <xsl:include> and <xsl:import> tags. So you can reuse ie. exslt.org modules or your own developed xslt modules.

The xslt processor also supports .NET extension objects. The extension objects should be public classes with a default constructor and not interfaces, abstract classes or generic classes. In order to use your extension objects you need to specify them in the “XsltPlugin.dll.config”. Under the “XsltExtensions” tag add the “extension” tags of your .NET extension objects. ie.

  <XsltPlugin>
    <XsltExtensions>
      <!--"assemblyPath" should be the full path to assembly-->
      <!--"type" should be the full namespace name of type-->
      <!-- if "type" is not specified then all types in assembly will be loaded into xslt-->
      <!-- if the alias is empty, when you reference the type in xslt you should reference it like this xmlns:hello = "urn:XsltExtensions.HelloXslt" -->
      <!-- if you have set the alias ie. "test", when you reference the type in xslt you should reference it like this xmlns:hello = "urn:test" -->
      <extension assemblyPath="C:\Program Files\Windows Live\Writer\Plugins\XsltExtensions.dll" type="XsltExtensions.HelloXslt" alias="" />
    </XsltExtensions>
  </XsltPlugin>

TIP: you can use an empty xml if you want to produce your content only from your extension objects.

If you used this plugin please comment on what you used it for

You can download the plugin from Live Writer plugins

No comments:

Post a Comment