|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Replacing all Occurences of a String
Roger,
If you construct your lookup table along the lines David suggested, you can use keys to rationalize (and optimize) access to it. So, try something like this in your dictionary.xml: <months> <month en="January" de="Januar" fr="Janvier"/> <month en="February" de="Februar" fr="Fevrier"/> [etc.] </months> Then, in your stylesheet <xsl:variable name="dictionary" select="document('dictionary.xml')"/>
<!-- This does nothing but make the dictionary document accessible
to the transformation --><xsl:key name="month-en" match="month" use="@en"/> <xsl:key name="month-de" match="month" use="@de"/> <xsl:key name="month-fr" match="month" use="@fr"/> <!-- These set up access to your dictionary --> When your source string is the name of a month in English, get its German equivalent by asking for key('month-en', $englishstring)/@de and, to go the other way, key('month-de', $germanstring)/@en This is a clean and easily-extensible way to manage the strings you need to replace in and out. Compress it even more if you know your languages will never step on each other: <xsl:key name="month" match="month" use="@en"/> <xsl:key name="month" match="month" use="@de"/> <xsl:key name="month" match="month" use="@fr"/> key('month', $string)/@de gives you German from English or French (or German)
key('month', $string)/@fr gives you French from English or German (or French)Enjoy, Wendell At 12:03 PM 8/30/01, Chris wrote: Roger, Have a look at http://www.biglist.com/lists/xsl-list/archives/200008/msg01300.html for some ideas on internationalization.... ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ====================================================================== XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|

Cart








