[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Another tokenize() question

Subject: Another tokenize() question
From: James Cummings <James.Cummings@xxxxxxxxxxxxxx>
Date: Tue, 10 Aug 2004 17:23:09 +0100 (BST)
xsl tokenize
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.