TEIC / Stylesheets

TEI XSL Stylesheets
231 stars 124 forks source link

unparsed-text() returned non-StreamSource for ../VERSION #586

Open eduarddrenth opened 1 year ago

eduarddrenth commented 1 year ago

This line

https://github.com/TEIC/Stylesheets/blob/6dbb58c2fa458879bcf5dd19f9c8b3c392d25b89/common/functions.xsl#L1380

may throw "Resolver for unparsed-text() returned non-StreamSource" when "../VERSION" cannot be resolved.

In my case I run odd2html.xsl from xml-maven-plugin, it gives me:

image

eduarddrenth commented 1 year ago

possible solution:

  <xsl:otherwise>
    <xsl:choose>
      <xsl:when test="unparsed-text-available('../VERSION')">
        <xsl:value-of select="normalize-space(unparsed-text('../VERSION'))"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:message terminate="no">../VERSION not found</xsl:message>
        <xsl:value-of select="0"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:otherwise>