I'd probably avoid string operations until the end, this implements it
essentially as counting base $b except using digits 1-n not 0-n the,
then just replaces the numeric digits by the values from the elements
(the alphabet $a)
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:n="data:n"
exclude-result-prefixes="n"
<xsl:template match="set">
<xsl:sequence select="n:f(element/string(.),count(element),0)"/>
</xsl:template>
<xsl:function name="n:f">
<xsl:param name="a"/>
<xsl:param name="b"/>
<xsl:param name="x"/>
<xsl:if test="count($x) le $b">
<sequence><xsl:sequence select="for $i in $x return $a[$i]"/></sequence>
<xsl:sequence select="n:f($a,$b,n:add($b,$x))"/>
</xsl:if>
</xsl:function>
<xsl:function name="n:add">
<xsl:param name="b"/>
<xsl:param name="x"/>
<xsl:sequence select="if(empty($x)) then 1 else
if($x[last()] lt $b)
then ($x[position()!=last()],$x[last()]+1)
else (n:add($b,$x[position()!=last()]),1)"/>
</xsl:function>
</xsl:stylesheet>
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--