Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


XSLT Transformation, invalid class string

From: Robbert <ikbenbereikbaarvia@-------.--->
To: NULL
Date: 11/3/2007 12:16:00 PM

Hi Guys,

In order to sort an RSS feed i've been trying to get a date sort
function to work. I'm calling a piece of vb script to do that and when
debugging the xslt in vs2005 the output is as i expected.
However, i cant get this to work in javascript. It keeps throwing an
"invalid class string" exception when i load the stylesheet. Without
the vb script in the xslt all works fine too, so something must be
going wrong in there i recon.

I hope u guys can help me out on this. Here´s some code:

** RSS.xml **

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet title="XSL_formatting" type="text/xsl"
href="stylesheet.xsl"?>
<rss xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
  <channel>
    ....
    <item>
      <title>Air France strike chaos continues</title>
      <description>More travel chaos is expected at ...</description>
 <link>http://news.bbc.co.uk/go/rss/-/2/hi/europe/7065944.stm</link>
      <guid isPermaLink="false">...</guid>
      <pubDate>Sun, 28 Oct 2007 14:37:45 GMT</pubDate>
      <category>Europe</category>
      <media:thumbnail width="66" height="49".... />
    </item>
...
  </channel>
</rss>


** SORT.xslt **

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version='1.0' 
                xmlns:xsl='http://www.w3.org/1999/XSL/Transform' 
	    xmlns:msxsl="urn:schemas-microsoft-com:xslt" 
                xmlns:util="urn:myScripts" 
                xmlns:xhtml='http://www.w3.org/1999/xhtml'
                xmlns:media="http://search.yahoo.com/mrss/"
                exclude-result-prefixes="xsl xhtml msxsl utility">
  
<msxsl:script language="vb" implements-prefix="util">
    function GetDate(pubDate As String)
    Try
    Dim myDate as Date = CDate(pubDate)
    Return myDate.ToString("yyyyMMddHHmmss")
    Catch

    End Try
    end function
  </msxsl:script>

  <xsl:output method="xml" version="1.0" encoding="UTF-8" />

  <xsl:template match="/rss/channel">        
    <xsl:for-each select="item">
      <xsl:sort order="ascending" select="util:GetDate(./pubDate)" />
        <p class="text">
          <xsl:apply-templates select="description" />
        </p>
    </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>


** JAVASCRIPT **
...
var xslt = new ActiveXObject("Msxml2.XSLTemplate.3.0");
var xslDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.3.0");
xslDoc.async = false;

xslDoc.load("sort.xslt");
xslt.stylesheet = xslDoc;

var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0");
xmlDoc.async = false;
xmlDoc.load(g_rssFeed);
...


The code breaks at:
xslt.stylesheet = xslDoc;
Throwing an "invalid class string" exception.

Anyone? :)

Regards,
Robbert.


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent