Hi all,
It looks like we missed some of the latest errata for string functions. In
particular, the behavior of substring-after() and substring-before() when
the second parameter is an empty string. Here's a quick-and-dirty
stylesheet, to illustrate.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8"/>
<xsl:template match="/">
<out>
<xsl:if test="starts-with('foo', '') = true()">
<xsl:text>
starts-with('foo', '') = true() passed</xsl:text>
</xsl:if>
<xsl:if test="contains('foo', '') = true()">
<xsl:text>
contains('foo', '') = true() passed</xsl:text>
</xsl:if>
<xsl:if test="substring-after('foo', '') = 'foo'">
<xsl:text>
substring-after('foo', '') = 'foo'
passed</xsl:text>
</xsl:if>
<xsl:if test="substring-before('foo', '') = ''">
<xsl:text>
substring-before('foo', '') = '' passed</xsl:text>
</xsl:if>
<xsl:text>
</xsl:text>
</out>
</xsl:template>
</xsl:stylesheet>
Can someone come up with some better test cases for inclusion in the
conformance suite?
Thanks!
Dave
|