XSL and JS- PROGID, createDocument & XSLTProcessor Issue

Here should go questions about transforming XML with XSLT and FOP.
Posts: 3
Joined: Wed May 21, 2008 8:36 am

XSL and JS- PROGID, createDocument & XSLTProcessor Issue

Post by freshbru » Mon Jun 02, 2008 9:14 am

Where do I begin...

OK, I have a Javascript function that loads a XML document, a XSL document, adds some parameters, does a transformation and creates a HTML document.

In IE, everything works PERFECTLY!

In Firefox I get the following error:
Error: uncaught exception: [Exception... "Component returned failure code: 0x8060000e [nsIXSLTProcessor.transformToDocument]" nsresult: "0x8060000e (<unknown>)" location: "JS frame :: http://localhost/application%20noticebo ... _script.js :: getApplications :: line 536" data: no]
In Opera I get the following (more verbose) error:
XSLT - file://localhost/C:/Inetpub/wwwroot/application%20noticeboard/xsl/application%20noticeboard.xsl
attribute at unknown location (no line number information available)
Error: invalid expression: Applications/Application[OrganisationApplicant[contains(translate(., $upper, $lower), $orgApp)] and Suburb[contains(translate(., $upper, $lower), $suburb)] and AreaPostCode[contains(translate(., $upper, $lower), $postCode)] and LGA[contains(translate(., $upper, $lower), $lGA)] and LicenceType[contains(translate(., $upper, $lower), $appType)] and Status[contains(translate(., $upper, $lower), $appStatus)] and msxsl:string-compare(number(concat('20',substring(LodgedDate,7,2),substring(LodgedDate,4,2),substring(LodgedDate,1,2))),$dtePosted,'en-US', 'i') = number($dteOperator)]
Call to undefined function: string-compare (namespace: urn:schemas-microsoft-com:xslt)
JavaScript - file://localhost/C:/Inetpub/wwwroot/application%20noticeboard/html/application%20noticeboard.html
Timeout thread: delay 1000 ms
Unhandled exception: [Object InternalException]
code: 5
Line 536 of linked script file://localhost/C:/Inetpub/wwwroot/application%20noticeboard/js/search_script.js
xmlDoc = xsltProc.transformToDocument(xmlDoc);
Line 1 of unknown script
getApplications("", getTextValue("orgApp"), getTodayDateSerial(), getDateSerial(getTextValue("dtePosted")), "", getOperator(getSelectValue("selectPosted")), getSelectValue("selectSuburbs"), getSelectValue("selectPostcode"), getSelectValue("selectLGA"), getSelectValue("selectAppType"),
So I have identified where the issue is occuring:

The function 'string-compare' in the namespace 'urn:schemas-microsoft-com:xslt' is not recognised.

When Using IE I am able to specify the PROGID for the XSL document I load using the following Javascript code:

Code: Select all

var xslt = new ActiveXObject('Msxml2.XSLTemplate.4.0');
xslt.stylesheet = xslDoc;
This means that by using the MSXML4.0 class, I can expose this 'string-compare' function as it is only available from MSXML4.0+

No problems...

However, I have to use the following code for non IE browsers Firefox, Opera, Mozilla etc to create an XSL document:

Code: Select all

var xsl=document.implementation.createDocument('','',null);
I appear to have no control as to which version of MSXML is used. I assume that this is MSXML2.0 or MSXML3.0... :shock:

I have been searching for hours for a solution but have hit a brick wall.

Does anyone know how to specify the PROGID for Firefox, Opera, etc when creating a document?

If anyone has any clues, advice or references that may solve the issue I would be very very grateful.

Thanks in advance,