[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Another tokenize() question
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|