[xsl] Another tokenize() question

Subject: [xsl] Another tokenize() question
From: James Cummings <James.Cummings@xxxxxxxxxxxxxx>
Date: Tue, 10 Aug 2004 17:23:09 +0100 (BST)
Ok, so now wanting to tokenize some lines in my existing 
xml file of poems I do:
-----------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="2.0">
 <xsl:output omit-xml-declaration="no" method="xml" indent="no" encoding="utf-8"/>

<xsl:template match="//@*|//node()|//text()" priority="-1">
<xsl:copy><xsl:apply-templates select="*|@*|node()|text()"/></xsl:copy>
</xsl:template>

<xsl:template match="l|head">
<xsl:element name="{name()}"><xsl:for-each select="tokenize(.,'\s+')[string(.)]">
<w><xsl:value-of select="." /></w>  </xsl:for-each></xsl:element>
</xsl:template>
</xsl:stylesheet>
-----------

This does correctly put a <w> tag around every whitespace separated
word.  But the problem is it doesn't apply any other templates 
inside the <l> or <head> elements.

i.e. sometimes there are empty milestone elements inside 
the lines, or places where letters of words are supplied 
like: wor<supplied>d</supplied>.

I'm sure this has been asked before, but how does one tokenize 
yet apply-templates within the thing you are tokenizing?

Thanks,
-James
---
Dr James Cummings, Oxford Text Archive, University of Oxford
James dot Cummings at oucs dot ox dot ac dot uk 
CALL FOR PAPERS: Digital Medievalism (Kalamazoo) and 
Early Drama (Leeds) see http://users.ox.ac.uk/~jamesc/cfp.html

Current Thread