Hello
I have xml source like this :
<?xml version="1.0"?>
<!-- modules names, functions names, elements names taken from
http://exslt.org -->
<modules>
<module name="dates and times" prefix="date">
<function name="add"/>
<function name="add-duration"/>
<function name="date"/>
<function name="date-time"/>
<function name="day-abbrevation"/>
<function name="day-in-month"/>
<function name="day-in-week"/>
<function name="day-in-year"/>
<function name="day-of-week-in-month"/>
<function name="difference"/>
<function name="duration"/>
<function name="format-date"/>
<function name="hour-in-day"/>
<function name="leap-year"/>
<function name="minute-in-hour"/>
<function name="month-abbrevation"/>
<function name="month-in-year"/>
<function name="month-name"/>
<function name="parse-date"/>
<function name="second-in-minute"/>
<function name="seconds"/>
<function name="sum"/>
<function name="time"/>
<function name="week-in-month"/>
<function name="week-in-year"/>
<function name="year"/>
<element name="date-format"/>
</module>
<module name="dynamic" prefix="dyn">
<function name="closure"/>
<function name="evaluate"/>
<function name="map"/>
<function name="max"/>
<function name="min"/>
<function name="sum"/>
</module>
<module name="common" prefix="exsl">
<function name="node-set"/>
<function name="object-type"/>
<element name="document"/>
</module>
<module name="functions" prefix="func">
<element name="function" />
<element name="result" />
<element name="script" />
</module>
<module name="math" prefix="math">
<function name="abs"/>
<function name="acos" />
<function name="asin" />
<function name="atan" />
<function name="atan2" />
<function name="constant" />
<function name="cos" />
<function name="exp" />
<function name="highest" />
<function name="log" />
<function name="lowest" />
<function name="max" />
<function name="min" />
<function name="power" />
<function name="random" />
<function name="sin" />
<function name="sqrt" />
<function name="tan" />
</module>
<module name="random" prefix="random">
<function name="random-sequence"/>
</module>
<module name="regular expressions" prefix="regexp">
<function name="match"/>
<function name="replace"/>
<function name="test"/>
</module>
<module name="sets" prefix="set">
<function name="difference"/>
<function name="distinct"/>
<function name="has-same-node"/>
<function name="intersection"/>
<function name="leading"/>
<function name="trailing"/>
</module>
<module name="strings" prefix="str">
<function name="align"/>
<function name="concat"/>
<function name="decode-uri"/>
<function name="encode-uri"/>
<function name="padding"/>
<function name="replace"/>
<function name="split"/>
<function name="tokenize"/>
</module>
</modules>
and stylesheet like this:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:date="http://exslt.org/dates-and-times"
xmlns:dyn="http://exslt.org/dynamic"
xmlns:exsl="http://exslt.org/common"
xmlns:func="http://exslt.org/functions"
xmlns:math="http://exslt.org/math"
xmlns:random="http://exslt.org/random"
xmlns:regexp="http://exslt.org/regular-expressions"
xmlns:set="http://exslt.org/sets"
xmlns:str="http://exslt.org/strings"
extension-element-prefixes="date dyn exsl
func math random regexp set str">
<xsl:output method="xml" encoding="utf-8" indent="yes"/>
<xsl:template match="/">
<html>
<head>
<style type="text/css">
.true {
color: green;
}
.false {
color: red;
}
table {
margin: 1em;
border: #999999 solid 1px;
border-spacing: 1px;
}
td {
padding: .1em .5em;
background: #eeeeee;
}
th {
padding: .1em .5em;
background: #bbbbbb;
text-align: left;
}
caption {
text-align: left;
font-weight: bold;
}
</style>
</head>
<body>
<h1>EXSLT support report for "<a
href="{system-property('xsl:vendor-url')}"><xsl:value-of
select="system-property('xsl:vendor')" /></a>"</h1>
<hr />
<xsl:apply-templates select="modules/module"/>
</body>
</html>
</xsl:template>
<xsl:template match="module">
<h2>module <xsl:value-of select="@name"/></h2>
<xsl:if test="function">
<table>
<caption>Functions</caption>
<tr>
<xsl:apply-templates select="function" mode="labels"/>
</tr>
<tr>
<xsl:apply-templates select="function" mode="values"/>
</tr>
</table>
</xsl:if>
<xsl:if test="element">
<table>
<caption>Elements</caption>
<tr>
<xsl:apply-templates select="element" mode="labels"/>
</tr>
<tr>
<xsl:apply-templates select="element" mode="values"/>
</tr>
</table>
</xsl:if> <hr/>
</xsl:template>
<xsl:template match="function | element" mode="labels">
<th>
<xsl:value-of select="@name"/>
</th>
</xsl:template>
<xsl:template match="function" mode="values">
<td class="{function-available(concat(../@prefix, ':', @name))}">
<xsl:value-of select="function-available(concat(../@prefix, ':',
@name))"/>
</td>
</xsl:template>
<xsl:template match="element" mode="values">
<td class="{element-available(concat(../@prefix, ':', @name))}">
<xsl:value-of select="element-available(concat(../@prefix, ':',
@name))"/>
</td>
</xsl:template>
</xsl:stylesheet>
The purpose of the stylesheet is to produce EXSLT support report for
XSLT processor which process it. I hope it can be usefull for anyone
especially begginers like me to have a such overview of supported EXSLT
features.
1.) I process this stylesheet by SAXON 6.5.5, SAXON 8.7.3, xsltproc
(libxslt 10119), MSXML with no problems, but XALAN-J 2.5.2 throws error
(i guess it's because function-available() ).
2.) I've noticed, the libxslt does not support func:function what do you
think about that.
Thank you.