Subject: Re: [xsl] tokenize From: Martin Honnen <Martin.Honnen@xxxxxx> Date: Fri, 14 Oct 2011 14:58:36 +0200 |
<xsl:template match="h:tbody/h:tr"> <!-- tokenise the uri so that we only extract valid data, eg <td class="xl">     /researchprofiles/A015/pcrowley/</td> --> <xsl:variable name="uri"> <xsl:value-of select="translate(h:td[@class='xl'],' 
','')"/> </xsl:variable> <xsl:variable name="urifrag" select="tokenize($uri,'/')"/> <xsl:text>"</xsl:text> <xsl:value-of select="$urifrag[1]"/> <xsl:text>"</xsl:text> <xsl:text>
</xsl:text> ... </xsl:template>
(the commented example is Tidy'd output from the 'analog' web logfile analyser). The result for the example td element is output as:
"/researchprofiles/A015/pcrowley"
In other words, not only has it not tokenized the string, but something has gobbled the trailing slash from the input content. I suspected that there was some character encoding error (slashes except the final one not being real slashes, perhaps) but they are all genuine.
I have clearly misunderstood how tokenize works (except that I have been using it perfectly happily elsewhere for years). The variable $urifrag seems to be returning the entire string rather than breaking it up, except for the trailing slash, which means it is actually splitting the string on its final slash only, instead of on all slashes.
Martin Honnen --- MVP Data Platform Development http://msmvps.com/blogs/martin_honnen/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] tokenize, Andrew Welch | Thread | Re: [xsl] tokenize, G. Ken Holman |
Re: [xsl] tokenize, Andrew Welch | Date | Re: [xsl] tokenize, G. Ken Holman |
Month |