Ticket #775 (assigned Task)

Opened 4 years ago

Last modified 4 years ago

workaround for lxml bug exposed by validation code

Reported by: rupert Owned by: paul
Priority: critical Milestone: V1.2 Questionnaire release
Component: WP6 - CMIP5 Questionnaire Version:
Keywords: Cc: gerry, charlotte
Requirement: http://metaforclimate.eu/Work-Package-2/Developing-the-CIM/Project-Requirements-summary.htm

Description (last modified by gerry) (diff)

the validation code uses lxml to perform schematron checks. The schematron itself makes use of the xsl import construct using a relative URI. However, lxml adds a spurious string://__STRING__XSLT__/ to the relative URI and therefore does not find the required xsl document.

The only way that Paul has found to get this to work in lxml is to use an absolute file path. It would be good to find a better solution if at all possible.

One option would be to revert to libxslt for the schematron processing as this worked previously.

Also, perhaps the lxml list might have some suggestions.

Change History

comment:1 follow-up: ↓ 3 Changed 4 years ago by gerry

  • Description modified (diff)

Hi Paul/Rupert?,

I'm a bit confused by this. Currently, I'm finding the error in validation when it tries to create the XSLT transformer (xslt = ET.XSLT(xsltTree)). Where are you hardcoding the absolute url? The only place I can see is in the schematron-report.xsl. Is this correct? I will change my sandbox version of this and if necessary will also look to changing the production version in the short term if this is correct.

comment:2 Changed 4 years ago by paul

  • Status changed from new to assigned

comment:3 in reply to: ↑ 1 Changed 4 years ago by paul

Replying to gerry:

Hi Paul/Rupert?,

I'm a bit confused by this. Currently, I'm finding the error in validation when it tries to create the XSLT transformer (xslt = ET.XSLT(xsltTree)). Where are you hardcoding the absolute url? The only place I can see is in the schematron-report.xsl. Is this correct? I will change my sandbox version of this and if necessary will also look to changing the production version in the short term if this is correct.

Yes, the URI that needs amending is the one on line 43 of schematron-report.xsl. It should be changed to use an absolute path to the skeleton1-5.xsl file it is attempting to import, e.g.

<xsl:import href="file:///<local-path-to>/cmip5q/xsl/skeleton1-5.xsl"/>

comment:4 Changed 4 years ago by gerry

Hi Paul,

I find that if I use '<xsl:import href="file:///xsl/skeleton1-5.xsl" />', i.e. leaving out the host/local path, that this appears to work (at least on my local system). I'm not sure if this will work on the deployed version, ie does it pick up the relative address there, but I will check that on the next deployment.

Gerry

comment:5 Changed 4 years ago by paul

OK - that doesn't work on my machine (?) but at least there is some workaround for everyone currently afflicted by the problem. I'll leave this Ticket open in case the same issue is encountered elsewhere.

Note: See TracTickets for help on using tickets.