Subject: Re: [xsl] troff to unicode conversion From: David Carlisle <davidc@xxxxxxxxx> Date: Mon, 11 Sep 2006 14:57:58 +0100 |
something like this would work I havent quite got the regexp right here but it should show the idea, which is construct a regexp that matches any escape sequence then once you find one, look it up in a key constructed by the mapping table to see what the replacement is. apply directly to your document (temp3.xml) David <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output encoding="US-ASCII"/> <xsl:variable name="map" select="doc('pvl_mappings.xml')"/> <xsl:key name="map" match="mapping" use="troff"/> <xsl:template match="*"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:apply-templates/> </xsl:copy> </xsl:template> <xsl:template match="text()"> <xsl:analyze-string select="." regex=".|\\\*?\(..|\\\*\(K\\\(wi"> <xsl:matching-substring> <xsl:value-of select="(key('map',.,$map)/unicode,.)[1]"/> </xsl:matching-substring> <xsl:non-matching-substring> <xsl:value-of select="."/> </xsl:non-matching-substring> </xsl:analyze-string> </xsl:template> </xsl:stylesheet>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] troff to unicode conversion, David J Birnbaum | Thread | [xsl]   appearing as ? in FF an, Steve |
Re: [xsl] Replace new lines by <br>, David Carlisle | Date | [xsl]   appearing as ? in FF an, Steve |
Month |