[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: troff to unicode conversion
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>
|
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
|