TODO: Create an XSLT Extension to show data on Front End

May 11, 2010 at 11:53 PM

Since the value is stored in the databse as an XML string, an XSLT extension is required to convert to an HTML table on the Front End.

May 12, 2010 at 7:17 AM

Can't you just use a normal XSLT file instead of an XSLT extension? If the XML is stored as a property in the database (in the cmsPropertyData table) it is also stored inside the umbraco.config file. No XSLT extension is required if it's stored inside the umbraco.config XML. The Tribal XPath node relations package does the same thing with a normal XSLT file.

May 12, 2010 at 8:36 AM
Sounds like a good idea, but I'm pretty new to xslt. Keen to write it?
May 12, 2010 at 11:30 PM

A file is definitely the way to go - users of this DataType will almost always have to do some sort of modification to suit client needs.

Also, I'd be happy to help writing the actual XSLT if you'd like some help in that area.

May 13, 2010 at 12:28 AM
Edited May 13, 2010 at 12:29 AM

Thanks @greystate, I'll add you as a Developer if you'd like to contribute to the project and help with the XSLT.

Here's an example of the XML that gets written to the umbraco.config file


<data alias="dimensions"><![CDATA[&lt;NewDataSet&gt;&lt;Dimensions&gt;&lt;Column1&gt;Desk&lt;/Column1&gt;&lt;Width&gt;1200mm&lt;/Width&gt;&lt;



May 14, 2010 at 12:11 PM

The xml you store in the umbraco.config is now stored as a string. For xslt it would be much easier if you store your data as xml. Here you can find a sample how this can be done:

May 15, 2010 at 11:37 PM

Hi Marko,

I'll second what jbreuer says, and go even further: The CDATA is useless from an XSLT standpoint, because it was never meant to do anything beyond simple string manipulation with raw text. With XML it's very powerful, so take a look at the link he posted. 

May 16, 2010 at 12:49 AM

Thanks for your comments @jbreuer & @greystate.

As far as I know there are 2 ways of creating custom Data Types, via a user control and via the 3/4 classes. i.e.

Does this mean I have to re-write the whole control? I believe the link @jbreuer posted is not related to the usercontrol Data Types.

Thanks for your help.


May 16, 2010 at 12:21 PM
Hi Marko, The link I posted is for the datatypes with 3/4 classes. It is highly recommanded you rewright your code using this method (otherwise you can't store xml the correct way). Here are 2 links how this can be done: and I have already done this several times. I don't mind doing it if you send me the source code of your user control. My e-mail is I'd be happy to help you :). Jeroen
May 16, 2010 at 12:55 PM

Thanks Jeroen - all the latest source code is here on CodePlex. I'll have a read through those 2 docs and see what I can make of them as it's my first Umbraco DataType.

Cheers - Marko

May 16, 2010 at 6:49 PM
Hi Marko, I hope you'll succeed in rewriting you package. If you need any help just let me know :). Jeroen
May 17, 2010 at 8:22 AM

Hi Marko. Thank you for your component. I hope you finish him without troubles. I want use him on my website (=.

Sorry for my bad english.



May 17, 2010 at 2:15 PM

Hey Jeroen I've sent you an email with some of the issues I've come across.

Pavel - thanks for your interest we should be able to finish it quickly - there isn't much more work left.



May 17, 2010 at 2:40 PM

Hi Mark,

I'm sorry but I made an error in my email. It's (without the first dot). Could you please send the e-mail again?


May 17, 2010 at 8:09 PM

Hi Marko,

When you have a sample of the 'real' XML format of the data, let me know and I'll put some XSLT together — I actually don't know where that should go? Will the datatype install a sample macro w/XSLT or how is this normally done for datatypes?

Regarding the actual format of the XML, I'd suggets something like the following (based on the screenshot data on

<data alias="Dimensions">
		<column header="Width" />
		<column header="Height" />
		<column header="Depth" />
		<row header="Product 0">
			<value><![CDATA[Width 0]]></value>
			<value><![CDATA[Height 0]]></value>
			<value><![CDATA[Depth 0]]></value>




May 17, 2010 at 9:56 PM

Hey Jeroen that's OK I've re-sent the email.

@greystate - I'll show you what the output looks like once we fix the outstanding issues - and we can certainly tweak it from there to get the best results.

Thanks both for your help,


May 17, 2010 at 10:03 PM
greystate wrote:

When you have a sample of the 'real' XML format of the data, let me know and I'll put some XSLT together — I actually don't know where that should go? Will the datatype install a sample macro w/XSLT or how is this normally done for datatypes?

Yes, check out the packages section under "Developer". You can create a package, select the necessary .dll's & Macro's and it copies the .xslt files automatically.



May 17, 2010 at 10:20 PM

Yeah - sorry 'bout that. I actually meant that I didn't know where to put it in the source files (codeplex), as I'm unsure whether it should (or could) be installed as an XSLT template in the dropdown when creating XSLT files in the Developer section.


May 17, 2010 at 10:52 PM

No worries :) I usually create a /xslt folder in the project and put my .xslt files in it. You can actually create the .xslt file through Umbraco and then copy/modify it within the solution.


May 18, 2010 at 12:09 PM
Edited May 18, 2010 at 12:11 PM
Hi guys. I'm newbie in developing for Umbraco. I tried parse xml from DynamicDataGrid in my xslt, but i fail. Can you tell me where i have mistakes?


<xsl:for-each select="$currentPage/data [@alias ='SpecificationsTable']/NewDataSet/Dimensions/Column1"> <xsl:value-of select="." /> </xsl:for-each>

Sorry for my bad english =).

May 19, 2010 at 5:22 AM

Hi Pavel, as you know the Data Type is still under development so I wouldn't recommend you use it yet. Once it's completed it will come with a default XSLT file which you'll be able to modify to suit your needs.

Jan 14, 2011 at 7:28 PM

Hi Marko,

I just implemented "store data as XML" (as opposed to [CDATA}) as well as finish wiring up the datatype to read and write to the db, and a few cosmetic changes. I sent you an email about requesting access to the project



Jan 18, 2011 at 9:49 AM

Hi Jonathan and thank you for your emai.

You're more than welcome to contribute your work to the project since I've been absolutely flat out and unable to put more effort into it.

Welcome aboard and let me know if I can be of any assistance.



Jan 18, 2011 at 11:04 AM

In Umbraco 4.6 you can do this with usercontrol wrapper aswell so you might not have to rewrite the code. See this sample:


Feb 12, 2011 at 12:43 AM
I put together an XSLT for my purposes to output from the datagrid in JSON notation. My immediate need is to produce a chart out of the content stored in the database. It's specific to my situation, but I put it here in case anyone else wants to use it as a departure point and adapt it. I'm still hoping to getting around to producing some more XSLTs (or maybe in RAZOR) for more generic use.

xml version="1.0" encoding="UTF-8"?> <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]> <xsl:stylesheet version="1.0" xmlns:xsl="" 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" xmlns:tagsLib="urn:tagsLib" xmlns:BlogLibrary="urn:BlogLibrary" exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets tagsLib BlogLibrary "> <xsl:output method="xml" omit-xml-declaration="yes"/> <xsl:param name="currentPage"/> <xsl:template match="/"> <![CDATA[[]]><!-- Insert "[" --> <xsl:for-each select="$currentPage/dynamicDataGrid/NewDataSet/*"> <!-- Check for bar or Pie chart --> <xsl:if test="umbraco.library:GetPreValueAsString($currentPage/chartType) = 'Bar / Line Chart'" > <!-- One or Two columns of data? --> <xsl:if test="./C1/@caption = 'Actual' and ./C2/@caption != 'Target'"> <xsl:call-template name="barChartData1Col"> <xsl:with-param name="dataSet" select="." /> </xsl:call-template> </xsl:if> <xsl:if test="./C1/@caption = 'Actual' and ./C2/@caption = 'Target'"> <xsl:call-template name="barChartData2Col"> <xsl:with-param name="dataSet" select="." /> </xsl:call-template> </xsl:if> </xsl:if><!-- end bar / line chart --> <xsl:if test="umbraco.library:GetPreValueAsString($currentPage/chartType) = 'Pie Chart'" > <xsl:call-template name="pieChartData"> <xsl:with-param name="dataSet" select="." /> </xsl:call-template> </xsl:if> </xsl:for-each> <![CDATA[]]]><!-- Insert "]" --> </xsl:template> <xsl:template name="barChartData1Col"> <xsl:param name="dataSet" /> <![CDATA[{]]><!-- Insert "{" --> <![CDATA['date': $.datepicker.parseDate('yy,m,d', ']]><xsl:value-of select="$dataSet/C0"/><![CDATA['),]]> <![CDATA['vals': []]><xsl:value-of select="$dataSet/C1"/><![CDATA[],]]> <![CDATA['captions': [']]><xsl:value-of select="$dataSet/C1/@caption"/><![CDATA[']]]> <![CDATA[}]]><!-- Insert "}" --> <xsl:if test="position() != last()"> <xsl:text>,</xsl:text> </xsl:if> </xsl:template> <xsl:template name="barChartData2Col"> <xsl:param name="dataSet" /> <![CDATA[{]]><!-- Insert "{" --> <![CDATA['date': $.datepicker.parseDate('yy,m,d', ']]><xsl:value-of select="$dataSet/C0"/><![CDATA['),]]> <![CDATA['vals': []]><xsl:value-of select="$dataSet/C1"/><![CDATA[,]]><xsl:value-of select="$dataSet/C2"/><![CDATA[],]]> <![CDATA['captions': [']]><xsl:value-of select="$dataSet/C1/@caption"/><![CDATA[',']]><xsl:value-of select="$dataSet/C2/@caption"/><![CDATA[']]]> <![CDATA[}]]><!-- Insert "}" --> <xsl:if test="position() != last()"> <xsl:text>,</xsl:text> </xsl:if> </xsl:template> <xsl:template name="pieChartData"> <xsl:param name="dataSet" /> <![CDATA[{]]><!-- Insert "{" --> <![CDATA['date': ']]><xsl:value-of select="$dataSet/C0"/><![CDATA[',]]> <![CDATA['vals': []]><xsl:value-of select="$dataSet/C1"/><![CDATA[],]]> <![CDATA['captions': [']]><xsl:value-of select="$dataSet/C1/@caption"/><![CDATA[']]]> <![CDATA[}]]><!-- Insert "}" --> <xsl:if test="position() != last()"> <xsl:text>,</xsl:text> </xsl:if> </xsl:template> </xsl:stylesheet>