Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: string to char conversion [Thread Next] Re: string to char conversionTo: NULL Date: 3/3/2006 2:56:00 AM Thank for replying so quickly,
I assumed that I need to solve the problem with a recursive algorythm,
my problem is I got no idea for a good stop critea, as I see no way to
save or get the number of chars I processed jet .
I tried (as mentioned in the first post) to increment a variable
(char_cntr) and compare it with the string-length(), if equals break,
but doesn`t work as I can`t increment variables.
My next idea was to get the number of "char" - children ( which is the
number of yet processed chars) , but children_num remains 0:
<xsl:template name="string_to_char">
<xsl:variable name="string_length" select="string-length(@value)"/>
<xsl:variable name="children_num" select="count(char)"/>
<xsl:if test="$string_length != $children_num">
<xsl:element name="char">
<xsl:attribute name="value">
<xsl:value-of select="substring(@value, children_num ,1)"/>
</xsl:attribute>
</xsl:element>
<xsl:call-template name="string_to_char"/>
</xsl:if>
</xsl:template>
>Apart from this, FXSL has a convenient str-foldl() function/template. It
>implements any char by char string processing.
Thanks, I `ll have a look at that.
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
