plazi/ggxml2taxpub

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

Closed this issue · 9 comments

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.

Also, Line 46 (<xsl:apply-templates select="//document/@docsource"/>) 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

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 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?

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

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.

Also got the pretty printing in place (#29), so I should be able to roll this out in the search portal in tonight's maintenance window.

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