Quick References
      ADO
      ASP
      CSS2
      HTML
      JavaScript
      Jet SQL
      VBScript
      WML
      WMLScript
      WSH
      XHTML
      XML DOM
      XSLT

Features
      Knowledge Base
      Tutorials

Partners
     ZVON.ORG
     XML
     Planet Source Code
     VisualBuilder
     Web Design
     Your HTML Source
     XML/XSLT Forums
     ASPAlliance
     Scripts
     
     Programmers Heaven
     Tek-Tips Forums
     Developer Fusion
     Code Project


   







XSLT FUNCTION:  element-available

Boolean = element-available('qname')
 
The element-available function is used to determine if the XSLT processor will support the use of the XSLT element cited in the argument. Currently, this is important when dealing with proprietary elements. In the future, this function will gain additional importance when you have to contend with more than one version of the W3C XSLT standard.
 
If the element is supported, true is returned. If the element is not supported, false is returned.
 
The xsl:fallback function is designed to provide fallback code that can be run as an alternative when an XSLT processor fails to support an element.
 
This test only applies to instruction elements, which are elements that can occur in a template body. The current W3C version of XSLT has 18 instruction elements. They are:
 
xsl:apply-imports xsl:fallback
xsl:apply-templates xsl:for-each
xsl:attributes xsl:if
xsl:call-template xsl:message
xsl:choose xsl:number
xsl:comment xsl:processing instruction
xsl:copy xsl:text
xsl:copy-of xsl:value-of
xsl:element xsl:variable

 
'qname'
 
The mandatory qname argument is the qname of the element to be tested. It is commonly enclosed by single quotes.
 
We use the DevGuru Staff List XML file for our example with the following header:
<?xml-stylesheet type="text/xsl" href="xslt_example_element avaiable.xsl"?>
and we name it: xslt_example_element available.xml
 
We test to see if the xsl:aardvark element is available.
 
Code for xslt_example_elementavailable.xsl:
 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<html>
<body>
<xsl:choose>
<xsl:when test="element-available('xsl:aardvark')">
<xsl:text>The xsl:aardvark element is available</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>The xsl:aardvark element is not available</xsl:text>
</xsl:otherwise>
</xsl:choose>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

 
Output:
 
Click to view output in separate window - requires Internet Explorer

 
 


Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information