[GeoNetwork-devel] Transformationexception due to date:format-date

Hi Francois,
I have been running into this error for some time now, and need to fix it for a workshop on Friday. Te problem is the following:

When harvesting from a WMS server, the transformation of the capabilities document fails in GeoNetwork (at least on the Windows and OS X machines I have used). I’ve nailed it down to the function call date:format-date() that apparently can not be found. This is strange because Xalan actually supports it, also in the version we use. I haven’t been able to find out what causes the error. For now I have committed a fix that will use the function if available, and otherwise only call the date:date-time() function that has no problems.

This is the culprit: gco:DateTime<xsl:value-of select=“date:format-date(date:date-time(),$df)”/></gco:DateTime>

It occurs in the files:

/web/geonetwork/xsl/conversion/OGCWxSGetCapabilitiesto19119/OGCWxSGetCapabilities-to-19119.xsl
/web/geonetwork/xsl/conversion/OGCWxSGetCapabilitiesto19119/OGCWxSGetCapabilitiesLayer-to-19139.xsl
/web/geonetwork/xsl/conversion/OGCWxSGetCapabilitiesto19119/identification.xsl

And the fix is in trunk. Maybe you have a better idea of the cause and thus a better fix :slight_smile: At least my workshop doesn’t fail now :slight_smile:

Ciao,
Jeroen

Here’s the stacktrace:


java.lang.NoSuchMethodException: For extension function, could not find method org.apache.xalan.lib.ExsltDatetime.formatDate([ExpressionContext,] #STRING, #STRING).
Checked both static and instance methods.
at org.apache.xalan.extensions.MethodResolver.getMethod(MethodResolver.java:316)
at org.apache.xalan.extensions.ExtensionHandlerJavaClass.callFunction(ExtensionHandlerJavaClass.java:335)
at org.apache.xalan.extensions.ExtensionsTable.extFunction(ExtensionsTable.java:227)
at org.apache.xalan.transformer.TransformerImpl.extFunction(TransformerImpl.java:461)
at org.apache.xpath.functions.FuncExtFunction.execute(FuncExtFunction.java:233)
at org.apache.xpath.Expression.executeCharsToContentHandler(Expression.java:357)
at org.apache.xalan.templates.ElemValueOf.execute(ElemValueOf.java:319)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2339)
at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:710)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2339)
at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:710)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2339)
at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:710)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2339)
at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:710)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2339)
at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:710)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2339)
at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:710)
at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:425)
at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:216)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2339)
at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:710)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2339)
at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:710)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2339)
at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:710)
at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:425)
at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:216)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2339)
at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2160)
at org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1213)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:668)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1129)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1107)
at jeeves.utils.Xml.transform(Xml.java:246)
at jeeves.utils.Xml.transform(Xml.java:229)
at org.fao.geonet.kernel.harvest.harvester.ogcwxs.Harvester.addMetadata(Harvester.java:275)
at org.fao.geonet.kernel.harvest.harvester.ogcwxs.Harvester.harvest(Harvester.java:227)
at org.fao.geonet.kernel.harvest.harvester.ogcwxs.OgcWxSHarvester.doHarvest(OgcWxSHarvester.java:212)
at org.fao.geonet.kernel.harvest.harvester.AbstractHarvester.harvest(AbstractHarvester.java:329)
at org.fao.geonet.kernel.harvest.harvester.Executor.run(Executor.java:87)