Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Products › Development › Forge › Module - XML Register  |  

 

dnn_pt_xml_170x64.gif

 

  Quick Links  
 


  Team Leadership  

Stefan Cullmann
Project Lead

 


  Team Members  

Sebastian Leupold

 


  DotNetNuke Projects  
The DotNetNuke Projects are a special category of platform extensions which are developed by volunteers to conform to the high professional standards mandated by DotNetNuke Corporation. The DotNetNuke Projects are distributed as a standard part of the DotNetNuke core application release offerings.

 


The best choice for your web site host, email hosting, and domain registration.
  Ads  
Iron Speed Designer is a software development tool for building database, reporting, and forms applications for .NET without hand-coding.
 


  Sponsors  

Meet Our Sponsors

The best choice for your web site host, email hosting, and domain registration.
CrystalTech Web Hosting™
Webhost4life, specialists in DNN hosting
Mad Development is a full service interactive agency focusing on the merge of design, technology, e-commerce, and affiliate marketing by providing total website solutions.
MadCap Software, Inc.
AspDotNetStoreFront - E-Commerce by Design - The Leading ASP.NET shopping cart platform for developers!
 


DotNetNuke® Project :: XML Module

The XML module is one of the 10 original modules which have been released as part of the IBuySpy portal. 

xml module

XML module is working in three steps;

  1. it queries XML Data,
  2. transforms the XML data using an XSL transformation,
  3. and returns the result back to the user.

  4. All settings are stored inside DotNetNuke.
 


Project Lead Blog
Jul 23

Posted by: Stefan Cullmann
7/23/2006

We have been asked in the forum about calculating columns inside User Defined Table. The new UDT 3.3.x release has introduced the new field type "Calculated Column" which could be used to calculate a cell value based on other values inside the row.

As Calculated Column is based on DataColumn.Expression which offers also offers aggregate functions like sum(), average() etc. 

Stuart Hilbert wants more and asks about a kind of running sum:

 shilbert wrote
I am trying to make a simple account worksheet.

I have columns named:

Debit
Credit
Total

Basically I want Total to be equal to Credit-Debit for that row.

I want my table to look like this.

Debit
Credit
Total

300
300
10

290
50

240


Is this possible?
 

Sure it is!

Well it is not possible using Calculated Column so this will be my first blog about XSL-Rendering inside User Defined Table.

Prepare your module

Insert a new UserDefinedTable module to your page. Add two new columns Debit and Credit with type Integer (or Currency or Decimal...) to the table:

Enter some sample data:

XML Representation of the Table Data

The XML data representation contains the actual data, the fields definitions and context information. Data is stored inside memory as dataset with three tables "Data", "Fields" and "Context". The dataset will be transferred as XML via DataSet.GetXml().

Example: account.xml, main extract:

Writing a XSL-Stylesheet

Open a new file Account.Xsl in your favorite editor.

First we have to define the xsl declaration and an output option which will omit the output of a xml declaration like :

Note the definition of the DotNetNuke/UserDefinedTable namespace. As the xml data is declared with this namespace we need to add an abbreviation for it. Every element inside the xml data must now be accessed with the prefix udt:.

Next we define the main template. It is defined for the root of the input document:

We will loop through all the rows inside the Data table using <xsl:for-each>:

Each row inside the Data table is rendered as one html table row:

<xsl:value-of> extracts the value of a selected node. If it is not present (=null) it will output an empty string.

<xsl:value-of> can also extract the value of xpath expressions. Luckily there is a xpath sum functions which calculates the sum over the given node set. Inside this example the nodeset consists of the current node (.) and all siblings before the current node (preceding-silbing) of the data type (::udt:Data) [Xpath axes]:

Finally we have to close all open tags:

This stylesheet above is very basic.

The extended stylesheet account.xsl provides permisson aware edit links, alternate row colors and conditional formatting.

Publish and select your Stylesheet

Open Manage User Defined Table of your module again. Jump to the Display settings and switch the rendering method to User Defined XSL Transformation. Upload your stylesheet.

Now the module is ready to work.

Tags:

Re: User Defined Table and the Power of XSL-Rendering

one word: wow!

By ErikVB on   7/24/2006

Re: User Defined Table and the Power of XSL-Rendering

Stefan,

This article is a beautiful, detailed example; it moved me to subscribe to your blog. This post is the sort of thing I was referring to in my Use Case Forum suggestion.

I am looking to create a Pledge Drive tracking solution using UDT, and I believe this example will do nicely. Off to tweak it and learn I go, thanks to you.

By Tikkune on   12/9/2006
 


Data Springs Inc. - Module Development
Data Springs is a leader in the DNN community offering high quality modules, custom module development, enhancements to the DNN core product and overall DNN support.
www.datasprings.com
XCESS expertise center b.v.
Custom made modules and complete solutions for the DNN framework. Maatwerk modules en complete webtoepassingen gebaseerd op het DNN framework.
www.xcess.nl
EMAS Pro
Strategic Enrollment Management Software for Higher Education Recruitment, Retention and Financial Aid
www.emaspro.com

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke® logo are registered trademarks of DotNetNuke Corporation
Hosted by MaximumASP