This project is read-only.

Function to return XML

Sep 1, 2010 at 5:36 PM


a new question :-)

I'm trying to implement a function (in partial class Helper) that would return an xml string to the xslt caller, but cannot navigate this with xsl:for-each.

First I call the function and put my string ina variable:


<xsl:variable name="rs" select="mdo:MyFunction()"></xsl:variable>                


Such function returns a string result, containing a simple xml like:




I then want to simply list those values:


<xsl:for-each select="msxsl:node-set($rs)//item">


but cannot get a result.

This should just work, isn't it?




Sep 1, 2010 at 7:21 PM


No, your code is wrong. msxsl:node-set works only with result tree fragment, i.e. xml declared in as xsl:variable body. This is NOT regular string.

You can use XsltDb extension mdo:node-set($rs). This function can accept xml as string, an absolute URL or relative URL (if begins with ~).

Unfortunately, it does not work with result tree fragment :-). I'll fix it in next release.

Sep 10, 2010 at 11:22 AM


I've created good sample of processing XML strings.

This sample shows how you can load Google News RSS and filter our all stuff you don't want to see on your site. I'm not sure this is legal but as a sample it makes sence.