plazi / ggxml2taxpub

Conversion of GoldenGATE XML to JATS/TaxPub at treatment level
0 stars 1 forks source link

"apply-templates" Selecting Plain String not Working in XSLT 1 #33

Closed gsautter closed 2 years ago

gsautter commented 2 years ago

Subject: https://github.com/plazi/ggxml2taxpub-treatments/blob/main/xslt/gg2tp_l1.xsl

Problem apply-templates doesn't seem to work (compile) in XSLT 1 if the select attribute evaluates to a string (Lines 42-46). Also, I cannot seem to spot which template this is supposed to defer to ... sure this shouldn't simply be a value-of instead of an apply-templates?

Also, Line 46 (<uri content-type="publication-doi"><xsl:apply-templates select="//document/@docSource"/></uri>) is a bit finicky, as the docSource attribute can very well also contain the URL that a article was downloaded from ... it might be safer to go for the DOI in the MODS header.

tcatapano commented 2 years ago

Also, Line 46 () is a bit finicky, as the docSource attribute can very well also contain the URL that a article was downloaded from ... it might be safer to go for the DOI in the MODS header.

see #34

tcatapano commented 2 years ago

Problem apply-templates doesn't seem to work (compile) in XSLT 1 if the select attribute evaluates to a string (Lines 42-46). Also, I cannot seem to spot which template this is supposed to defer to ... sure this shouldn't simply be a value-of instead of an apply-templates?

@gsautter I'm not seeing a problem. Could you describe what errors you are encountering? I'm expecting the behavior of the XSLT built-in template rule is to output the text of a text node in the absence of a specific template in the stylesheet.

gsautter commented 2 years ago

@gsautter I'm not seeing a problem. Could you describe what errors you are encountering? I'm expecting the behavior of the XSLT built-in template rule is to output the text of a text node in the absence of a specific template in the stylesheet.

Java's on-board Xalan engine basically complains "Error checking type of the expression 'com.sun.org.apache.xalan.internal.xsltc.compiler.ApplyTemplates@'.", most likely because it expects a node set in the result of the select attribute of apply-templates ...

So, since you expect a plain string in the output anyway, could you just use value-of instead of apply-templates?

tcatapano commented 2 years ago

Yes, I see now that in oxygen using xalan (not saxon) I get an error:

System ID: C:\Users\Terry\Github\ggxml2taxpub-treatments\xslt\gg2tp_l1.xsl
Scenario: gg2tp_l1
XML file: C:\Users\Terry\Github\ggxml2taxpub-treatments\ggxml\0A1D87A8FF3AFF51FDCEFD32FEEFFC4A.xml
XSL file: C:\Users\Terry\Github\ggxml2taxpub-treatments\xslt\gg2tp_l1.xsl
Engine name: Xalan (Deprecated)
Severity: fatal
Description: Can not convert #STRING to a NodeList!

I'll change to value-of

tcatapano commented 2 years ago

seems to be working now on ggserver. See:

https://tb.plazi.org/GgServer/xslt/21095E52CF76C310FE5556E8609BEC92?xsltUrl=https://raw.githubusercontent.com/plazi/ggxml2taxpub-treatments/main/xslt/gg2tp_l1.xsl

gsautter commented 2 years ago

seems to be working now on ggserver. See:

https://tb.plazi.org/GgServer/xslt/21095E52CF76C310FE5556E8609BEC92?xsltUrl=https://raw.githubusercontent.com/plazi/ggxml2taxpub-treatments/main/xslt/gg2tp_l1.xsl

That looks pretty good indeed, thanks. Also loads nicely in my local test.

gsautter commented 2 years ago

Also got the pretty printing in place (https://github.com/plazi/ggxml2taxpub-treatments/issues/29), so I should be able to roll this out in the search portal in tonight's maintenance window.

gsautter commented 2 years ago

seems to be working now on ggserver. See:

https://tb.plazi.org/GgServer/xslt/21095E52CF76C310FE5556E8609BEC92?xsltUrl=https://raw.githubusercontent.com/plazi/ggxml2taxpub-treatments/main/xslt/gg2tp_l1.xsl

Now also available as https://tb.plazi.org/GgServer/taxPubL1/21095E52CF76C310FE5556E8609BEC92 (and any other treatment as well).

gsautter commented 2 years ago

@tcatapano thanks for making those changes so quickly. Really happy to have this one sorted out.