Code: Select all
<xsl:when test="/article/front/article-meta/article-id[@pub-id-type = 'doi']">
<xsl:value-of select="/article/front/article-meta/article-id[@pub-id-type = 'doi']"/>
<xsl:message>ERROR: Cannot find DOI</xsl:message>
<xsl:value-of select="replace($doi, '^10.[0-9]+/', '')"/>
When I ran the transformation on a file that I knew was missing the expected <article-id> element, I was surprised not to see the error message appear. Eventually I discovered that when neither the 'doi' nor the 'doi-suffix' variable was used in any of my templates, the variable definitions seemed not to be processed at all. When I added either variable to the output of any template, things worked as expected again.
I don't know if this is a characteristic of Saxon (my transformation is using the SaxonPE-220.127.116.11 processor) or Oxygen (version 18.1), but it feels buggy.