Re: [xslt] str:tokenize won't split strings into chars?



Peter Pawlowski said:
> Hello,
>
> Am I overlooking something or is the str:tokenize extension not
> working
> properly? The description on this page:
>
>    http://www.exslt.org/str/functions/tokenize/index.html
>
> suggests that if the second argument to str:tokenize is an empty
> string, it will
> return a node-set of token elements containing one character each.
>
> But when I run this XSL:
>
>
> <?xml version="1.0"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>    xmlns:str="http://exslt.org/strings";
>    extension-element-prefixes="str"
>    version="1.0"
>>
>
> <xsl:template match="/*">
>    <a>
>      <xsl:copy-of select="str:tokenize('abc', '')" />
>    </a>
> </xsl:template>
>
> </xsl:stylesheet>
>
>
> on any XML, I get this output:
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <a><token>abc</token></a>
>
>
> instead of this:
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <a><token>a</token><token>b</token><token>c</token></a>
>
>
> I couldn't find any mention of this on the list archive or in
> Bugzilla, my
> apologies if it's already been addressed. My xsltproc:
>
> [pawlowski libxslt]$ ./xsltproc --version
> Using libxml 20611, libxslt 10108 and libexslt 806
> xsltproc was compiled against libxml 20611, libxslt 10108 and
> libexslt 806
> libxslt 10108 was compiled against libxml 20611
> libexslt 806 was compiled against libxml 20611
>
>
> Thanks, I really appreciate your help!
>
> Peter

Ooops....  The spec is certainly clear, and the behaviour of the
library certainly didn't correspond to it :-\.  Fixed in CVS
(libexslt/strings.c)

bill bbrack work $ xsltproc bug.xsl bug.xsl
<?xml version="1.0"?>
<a><token>a</token><token>b</token><token>c</token></a>

Thanks for the report.

Bill



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]