Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 1st, 2014, 05:54 PM
Authorized User
Join Date: Aug 2013
Posts: 30
Thanks: 9
Thanked 0 Times in 0 Posts
Default unexpected zero-length tokenize()

Dear all,

I have a series of files, some of which I need to tokenize, some of which not.

this is an example of both types

text 〈: in latere intuentibus sinistro〉 text 〈: in latere intuentibus dextro〉 text

text 〈: in latere intuentibus sinistro〉 text 

the code I have done in my understanding should first look for the separating string 〈:***whichever***〉, but only use it to tokenize when it is there. if that is not present, just apply other templates.

<xsl:variable name="sections">
        <xsl:analyze-string select="." regex="(〈):(in latere intuentibus sinistro|in latere intuentibus dextro|in epystilio|in ipsa aedicula|in una linea|in parte aversa|in fgr.\s\w*\s*|in columna\s\w*\s*)(〉)">
                <xsl:sequence select="."/> 
    <xsl:template name="div[@type='edition']">
            <xsl:apply-templates select="@*"/>
                <xsl:when test="contains(., $sections)">
                    <xsl:for-each select="tokenize(., $sections)">
                        <div n="{position()}" type="textpart">
What happens is that with example 1 it returns the string, in example 2 actually performs the tokenize() and do the rest of the work nicely, in example 3 I get an Error (rightly) saying that tokenize is a zero length string... I understand why this second error comes, as the string is not there. I do not understand why it got to the point of evaluating that piece of xsl.

Thanks for any help.

Last edited by pietromaria.liuzzo; April 2nd, 2014 at 11:36 AM..

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tokenize in XSLT 1.0 using for-each for tokens chilly XSLT 0 April 20th, 2010 08:13 PM
Tokenize and REGex Question bonekrusher XSLT 4 January 22nd, 2010 07:10 AM
Tokenize JohnBampton XSLT 7 August 25th, 2009 07:34 AM
tokenize bbvic XSLT 1 July 19th, 2007 04:10 PM
tokenize sakura C# 1 December 3rd, 2005 10:43 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.