Display custom XML in Umbraco usign XSLT? Options
Itamar
Posted: Tuesday, October 30, 2007 10:46:41 AM
Rank: Devotee

Joined: 10/30/2007
Posts: 85
Location: Israel
Hi,

It is my understanding that there is a way to create a class in .NET that may interface with its own data structures (for example, custom DB tables) and output data as XML. Then I can somehow access this XML from Umbraco and treat it as if it was the Umbraco cache XML, to display data just like as the entries were Umbraco nodes.

How can this be achieved - both from the .net code and the XSLT prespective? And how would I "install" that .net code in Umbraco?

Thanks in advance,

Itamar.
Itamar
Posted: Wednesday, October 31, 2007 11:25:34 PM
Rank: Devotee

Joined: 10/30/2007
Posts: 85
Location: Israel
Can anyone help me? Should I rephrase to make what I need clearer?

Itamar.
mortenbock
Posted: Thursday, November 01, 2007 9:58:13 AM

Rank: Addict

Joined: 7/19/2006
Posts: 790
Location: Århus, Denmark
Take a look at this article:

http://en.wikibooks.org/wiki/Umbraco/Create_xslt_exstension_like_umbraco.Library_in_C

It explains how to make an xslt extension.

If that extension returns an XPathIterator, then you can use XSLT to transform it.

Morten Bock - Level 2 certified - MVP 2008/2009 - My danish blog with a few english posts

Itamar
Posted: Friday, November 02, 2007 1:29:23 AM
Rank: Devotee

Joined: 10/30/2007
Posts: 85
Location: Israel
Thanks.

How would I call the function in the class, and use the XPathNodeIterator returned from it? Can you post a short XSLT source demonstrating that?

Also, how would the Umbraco caching work for such a page (assuming the XSLT will pass a querystring var to the class)?

Itamar.
NeilG
Posted: Friday, November 02, 2007 9:44:58 AM

Rank: Aficionado

Joined: 12/15/2006
Posts: 113
As the article points out:

1. Create the class library.
2. Create the class you need.
3. Add the methods you need.
4. Compile to DLL & copy to Umbraco "bin".
5. Register DLL by updating "xsltExtensions.xml" - if 2.1.7 or "xsltExtensions.config" if 3.0.3.
6. Add namespace to any XSLT you want to use:
Code:
<xsl:stylesheet
    version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxml="urn:schemas-microsoft-com:xslt"
    xmlns:umbraco.library="urn:umbraco.library"
        xmlns:YourLibrary="urn:YourLibrary"
    exclude-result-prefixes="msxml umbraco.library YourLibrary">

7. Call methods:
Code:

        <xsl:variable name="input" select="umbraco.library:RequestQueryString('input')" />
        <xsl:variable name="nodeSet" select="YourLibrary:SuperMethod($input)" />
        <xsl:for-each select="$nodeSet/node">
             <cite><xsl:value-of select="@id" /></cite>
        </xsl:for-each>



Neil


___________________________________________________________________________________

Neil
Itamar
Posted: Friday, November 02, 2007 10:51:31 AM
Rank: Devotee

Joined: 10/30/2007
Posts: 85
Location: Israel
Awesome, thanks.

Itamar.
Itamar
Posted: Saturday, November 03, 2007 5:17:26 PM
Rank: Devotee

Joined: 10/30/2007
Posts: 85
Location: Israel
Hi again,

How would the Umbraco caching work for a page based on this XSLT (assuming the XSLT will pass a querystring var to the class)?

Itamar.
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.