function-available(string)函数用于测试某个函数是否可以被XSLT处理器解析。参数string用于指定要测试的函数名。

      语法:function-available(string)

      参数:string字符串,必需

      返回:布尔型

示例:

xml:

  1. <?xml version="1.0" encoding="UTF-8"?>
    <books>
       <book id="1">
            <name>XSLT</name>   
       </book>
    </books>

xslt:

  1. <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
         <xsl:output method="html" version="1.0" encoding="gb2312" indent="yes"/>    
        <xsl:template match="/books">
           <xsl:choose>
                <xsl:when test="function-available('current')">
                   <xsl:copy-of select="."/>
                </xsl:when>
                <xsl:otherwise>
                   <xsl:text>current函数不可用</xsl:text>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:template>
    </xsl:stylesheet>

结果:

  1. XSLT

相关文章:

  • 2021-10-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-28
  • 2021-11-09
  • 2021-09-28
猜你喜欢
  • 2021-12-11
  • 2022-03-05
  • 2021-11-23
  • 2022-02-20
  • 2021-08-14
  • 2021-10-23
  • 2021-05-30
相关资源
相似解决方案