4
하나의 스타일 시트에서 XSLT 2.0 및 XSLT 3.0 프로세서 모두에서 unparsed-text-lines() 함수를 효과적으로 사용하려면 어떻게해야합니까?아직 XSLT에서 사용할 수없는 기능에 대한 코드가 어떻게 대체 되나요?
필자는 function-available() 함수를 사용할 수 있다고 생각했지만 XSLT 2.0 프로세서의 구문 오류를 반환합니다.
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:local="local"
version="2.0" exclude-result-prefixes="xs fn local">
<xsl:function name="local:unparsed-text-lines" as="xs:string+">
<xsl:param name="href" as="xs:string" />
<xsl:choose>
<xsl:when test="function-available('fn:unparsed-text-lines')">
<!-- XSLT 3.0 -->
<xsl:sequence select="fn:unparsed-text-lines($href)" />
</xsl:when>
<xsl:otherwise>
<!-- XSLT 2.0 -->
<xsl:sequence select="fn:tokenize(fn:unparsed-text($href), '\r\n|\r|\n')[not(position()=last() and .='')]" />
</xsl:otherwise>
</xsl:choose>
</xsl:function>
etc.
감사합니다. 나는 원래 xsl : use-when을 xsl : level에서 시도했으나 여전히 컴파일에 실패했다. 감사. –
@ SeanB.Durkin : 천만에요. –
@DimitreNovatchev 이것은 단지 내 하루를 저장, 감사합니다 :) – quaylar