Project

Profile

Help

Cannot get .net extension to work

Added by Anonymous about 15 years ago

Legacy ID: #7760906 Legacy Poster: Wabiloo ()

Hi, I've been trying to create a .Net extension to use within my XSLT, which I execute with Saxon-D 9.2, either at the command line or from within Oxygen 10. I can't use the GAC, so I'm compiling the class into a .DLL and loading it from file, using the 'from' argument in the clitype URI. No matter what I do though, I still get the same error: Error at xsl:value-of on line 12 column 31 of IntegTest.xsl: XPST0017: XPath syntax error at char 25 on line 12 in {dtl10n:SayHello('world!')}: Cannot find a matching 1-argument function named {clitype:FlexData.DateTimeL10n?from=DateTimeL10n.dll}SayHello() Failed to compile stylesheet. 1 error detected. I've tried copying the DLL into the Saxon directory, the Oxygen directory, the directory in which the XSL file is located, the directory in which the XML file is located. Same goes if I try an absolute path instead, with xmlns:dtl10n="clitype:FlexData.DateTimeL10n?from=file:///D:/IM%20Projects/Ranmore/Investigations/Internationalisation/DateTimeL10n/DateTimeL10n/bin/Release/DateTimeL10n.dll" Error at xsl:value-of on line 12 column 31 of IntegTest.xsl: XPST0017: XPath syntax error at char 25 on line 12 in {dtl10n:SayHello('world!')}: Cannot find a matching 1-argument function named {clitype:FlexData.DateTimeL10n?from=file:///D:/IM%20Projects/Ranmore/Investigations/Internationalisation/DateTimeL10n/DateTimeL10n/bin/Release/DateTimeL10n.dl l}SayHello() Is there something I'm missing? Maybe it's the .Net code itself? It's very simple though (compiled into DateTimeL10n.dll): using System; using System.Text; namespace FlexData { public static class DateTimeL10n { public static string SayHello(string who) { return "Hello " + who; } } } Here is the XSL (2.0): <xsl:template match="/"> <xsl:value-of select="base-uri()"></xsl:value-of> <xsl:value-of select="dtl10n:SayHello('world!')"></xsl:value-of> </xsl:template> Thanks for any help


Replies (2)

RE: Cannot get .net extension to work - Added by Anonymous about 15 years ago

Legacy ID: #7761080 Legacy Poster: Michael Kay (mhkay)

Saxon-D is surely a misprint! In 9.2, the old style dynamically loaded extension functions are no longer available in the HE edition: you need Saxon-PE or Saxon-EE. This might be the source of your problem. If it is, then the solution might be one of the following: - stick with Saxon-B 9.1 - upgrade to Saxon-PE 9.2 - switch to using the new "integrated extension functions". Alternatively, it might just be that you're having trouble with the environment for dynamic loading. I'm afraid this seems to be something of a black art (which was one reason integrated extension functions were introduced). Using the -TJ option on the command line may give you better diagnostics.

RE: Cannot get .net extension to work - Added by Anonymous about 15 years ago

Legacy ID: #7765854 Legacy Poster: Wabiloo ()

Saxon-D is indeed a misprint. Having checked the oXygen (v10.2) about page, I read that the version used is actually Saxon-SA 9.1, not 9.2 as stated (my mistake). At the command line, I used Saxon-B 9.1, again, not 9.2 as stated. (not to self: always check your version number, stop assuming) Therefore, it should have worked, if I understand you well. I may therefore have to give the integrated extension a go (though no idea how oXygen deals with that), but fear this might make my XSLT not portable with AltovaXML (which currently works with that extension)...

    (1-2/2)

    Please register to reply