only for RuBoard |
xsl:otherwise provides a default for multiple condition testing, used with the xsl:choose and xsl:when elements. A similar construct is the else keyword in most programming languages that is used with an if statement.
None.
Suppose that you want to create a numbered outline from the data in an XML file. Consider the following XML file, links.xml :
<links> <link name="NewRiders.com" URL="http://www.newriders.com"> /> <link name="Xmlandasp.net" URL="http://www.xmlandasp.net" /> <link name="MSDN Online Library" URL="http://msdn.microsoft.com/library" /> </links>
Specify that you are outputting version 4.0 HTML and do not want an XML declaration at the beginning of the output:
<?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="4.0" omit-xml-declaration="yes" /> <xsl:template match="/"> <html> <head></head> <body></body> <table> <xsl:apply-templates /> </table> </html> </xsl:template> <xsl:template match="link"> <tr> <td> <xsl:value-of select="@name" /> </td> </tr> </xsl:template> </xsl:stylesheet>
Applying the stylesheet to links.xml would produce version 4.0-compliant HTML. Notice the meta tag generated that specifies the content type, and the lack of an XML declaration at the beginning of the HTML output:
<html> <head> <META http-equiv="Content-Type" content="text/html; charset=UTF-16"> </head> <body> </body> <table> <tr> <td> NewRiders.com </td> </tr> <tr> <td> Xmlandasp.net </td> </tr> <tr> <td> MSDN Online Library </td> </tr> </table> </html>
xsl:choose
xsl:apply-templates, xsl:attribute, xsl:call-template, xsl:choose, xsl:comment, xsl:copy, xsl:copy-of, xsl:element, xsl:for-each, xsl:if, xsl:processing-instruction, xsl:text, xsl:value-of, xsl:variable, output elements
only for RuBoard |