12 votes

XsltResult

UPDATE 6th Sept 09

Version 1.1 Released. The control now contains CacheXslt and CacheHtml properties. N.B. Caching is based on the controls ID, so use unique ID's.

SUMMARY

This package allows xslt files to be referenced from a template without the need to create an intermediary macro. This can remove the need for macro's completely from some sites, with the exception of RTE injected macros.

Example: you have a xslt called Navigation.xslt which you need to add to a template. Rather than creating a macro you can now just write

<XsltResult:XsltResult runat="server" XsltFilename="xslt/Navigation.xslt" NavigationType="Primary" />

All xslt extensions are still loaded as normal.

N.B. Remember to register the control using <%@ Register TagPrefix="XsltResult" Assembly="XsltResult" Namespace="XsltResult" %>.

 

PARAMETERS

The parameter 'NavigationType' in the example above is a completely custom parameter that XsltResult doesn't know about (and doesn't care about!). If such parameters are detected then they are passed directly to the xslt file. They should be declared in your xslt file as follows:

<xsl:param name="NavigationType" />

 

SUB FOLDERS

As you specify the XsltFilename you can now organise your xslt files into sub folders. For Example:

  • xslt/Navigation/Navigation.xslt
  • xslt/Listings/NewsList.xslt

 

INLINE XSLT

I've also included support for InlineXSLT. You can use this when you don't wish to create an separate xslt file. This may be because you will only use this piece of xslt once.

<XsltResult:XsltResult runat="server">
  <InlineXslt>
   <xsl:param name="currentPage"/>
     <xsl:template match="/">
    <xsl:value-of select="
$currentPage/@nodeName"/>
   </xsl:template>
  </InlineXslt>
 </XsltResult:XsltResult>

The above example doesn't include the full xslt file, however you can specify it if you wish.

 

BUGS & ISSUES

Please raise any issues on the forum below. All feedback is welcome and appreciated.

The source code is now available below.

 

Package owner

Chris Koiak

Chris Koiak

Chris has 2626 karma points

Package Compatibility

This package is compatible with the following versions as reported by community members who have downloaded this package:
Untested or doesn't work on Umbraco Cloud
8.0.x (untested)
7.13.x (untested)
7.12.x (untested)
7.11.x (untested)
7.10.x (untested)
7.9.x (untested)
7.8.x (untested)
7.7.x (untested)
7.6.x (untested)
7.5.x (untested)
7.4.x (untested)
7.3.x (untested)
7.2.x (untested)
7.1.x (untested)
7.0.x (untested)
6.1.x (untested)
6.0.x (untested)

You must login before you can report on package compatibility.

Package Information

  • Package owner: Chris Koiak
  • Created: 06/08/2009
  • Current version 1.1
  • License MIT
  • Downloads: 3556