Problem :
<xsl:when>
is a runtime operator, and the compiler at compile time does not know that its result will be true() or false() .
Solution . Use the use-when attribute.
The conversion becomes something like this:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:local="local" version="2.0" exclude-result-prefixes="xs local"> <xsl:function name="local:unparsed-text-lines" as="xs:string+"> <xsl:param name="href" as="xs:string" /> <xsl:sequence select="fn:unparsed-text-lines($href)" use-when="function-available('unparsed-text-lines')" /> <xsl:sequence use-when="not(function-available('unparsed-text-lines'))" select="tokenize(unparsed-text($href), '\r\n|\r|\n') [not(position()=last() and .='' ) ]" /> </xsl:function> </xsl:stylesheet>
, and now no error occurs .
source share