Audun Røe wrote:
Hi,
I have a list of codes which I want translated into something
"understandable". Is there a mechanism such as hashtables that could
handle this? (eg. PHP: array('F' => 'Foo', 'C' => 'Cat'))
It just seems as if a page worth of if-tests would be a fairly clumsy
solution to this (there are a lot of codes) problem.
Basically, I have an XML-document which looks like something like
this:
<Element T="F">.....</Element>
..and I want it transformed into the code's corresponding descriptive
name, like so (F ==> Foo):
<NewElement DN="Foo">.....</NewElement>
All sugestions appreciated!
--
Regards.
Audun
hi,
the better way, i think, is to define something like this snippet
stylesheet, and import it in your master stylesheet :
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:date="http://www.foo.com/Processing/dates">
<date:month-names>
<date:month short="jan">january</date:month>
<date:month short="feb">february</date:month>
<date:month short="mar">march</date:month>
<date:month short="apr">april</date:month>
<date:month short="may">may</date:month>
<date:month short="jun">june</date:month>
<date:month short="jul">jully</date:month>
<date:month short="aug">august</date:month>
<date:month short="sep">september</date:month>
<date:month short="oct">october</date:month>
<date:month short="nov">november</date:month>
<date:month short="dec">december</date:month>
</date:month-names>
<xsl:template name="date:month-name">
<!--returns the name of the month from its number-->
<xsl:param name="month" select="0"/>
<xsl:value-of
select="document('')/*/date:month-names/date:month[$month]"/>
</xsl:template>
</xsl:stylesheet>
--
Cordialement,
///
(. .)
-----ooO--(_)--Ooo-----
| Philippe Poulard |
-----------------------