This project is read-only.


mdo:service tag allows you to create an XML services inside a configuration. XsltDb XML service is a method of executing configurations using DesktopModules/XsltDb/ws.aspx handler. If you need to provide some text, XML, HTML or JSON data by specifying a URL you can call whole configuration as a service or create an mdo:service section inside a calling configuration. The following example creates a service that returns static HTML fragment:

<mdo:service name="some-service" type="text/html">
<h1>Hello, World</h1>
<iframe src="{mdo:service-url('some-service')}" />
mdo:service tag has 2 parameters
  • name - service name that is used to call service
  • type - Content type returned by service Can be text/plain, text/xml and text/html. If you don’t specify xsl:output tag (as in sample above) XsltDb uses transformation method based on service content type: xml for text/xml, html for text/html and text for text/plain.

Look at src attribute of iframe tag. We use mdo:service-url function to build service URL. It accepts name of the service and returns parameterized URL that leads to the service. In the sample above we used iframe HTML tag to load data from server and show it in browser. However, you can use this URL to provide data services for external users and sites or as data source for your AJAX controls.

Inside mdo:service tag you can use any XSL and XsltDb features that don’t require page context. You can query and update database, access external data sources read files, etc. the following example shows how to create a service that returns a list of files in XML format:

<mdo:service name="countries" type="text/xml">
<xsl:variable name="sql">
  select * from dnn_Lists where ListName = 'Country'
  <xsl:for-each select="mdo:sql($sql, 'country')//country">

<iframe src="{mdo:service-url('countries')}" />

After I put both samples in single configuration I have got the following:

Last edited Aug 4, 2010 at 7:43 PM by findy, version 11


No comments yet.