[xslt] exslt question



Hi all,

I'm trying to access the individual tokens when using the exslt
str:tokenize() function.  In the following code (based on the code
from tokenize.1.xsl in the libxslt test directory) I try to extract
the second token:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:str="http://exslt.org/strings";
    exclude-result-prefixes="str">

  <xsl:output method="xml" indent="yes"/>

  <xsl:template match="/">
    <xsl:copy-of select="str:tokenize('date math str')"/>
    <xsl:text>&#xA;</xsl:text>
    <xsl:text>&#xA;</xsl:text>
    <!-- now try to get just the second one -->
    <xsl:copy-of select="str:tokenize('date math str')[position() = 2]"/>
    <xsl:text>&#xA;</xsl:text>
  </xsl:template>

</xsl:stylesheet>
 
This doesn't work however, I get the following garbled output:

----------------------------------------------------------------------
<?xml version="1.0"?>
<token>date</token><token>math</token><token>str</token>

<(àB(àB>
<text>&#x7D2;B&#x7D2;B</text>
</(àB(àB>
----------------------------------------------------------------------

The tags even include some control characters. (!) 

I guess this isn't the right way to extract the second token...
Can anybody tell me how to do that?

Geert



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