[Home] [By Thread] [By Date] [Recent Entries]
pankaj.c@xxxxxxxxxxxxxxxxxx wrote:
Any direction in this regard will be highly appreciated. (NOTE: Input will be <date-printed>August 2010</date-printed> i.e., Month name [space] Year. Output required is Aout 2010) As long as that format is ensured it should be easy simply create a secondary XML document which maps the English names to the French names e.g. <map> <!-- put complete mapping here --> <month en="August" fr="Aout"/> </map> then load that file with the document function e.g. <xsl:variable name="month-map" select="document('map.xml')"/> then define a key e.g. <xsl:key name="mk" match="month" use="@en"/> then process e.g. <xsl:template match="date-printed">
<xsl:copy>
<xsl:variable name="em" select="substring-before(., ' ')"/>
<xsl:for-each select="$month-map">
<xsl:value-of select="key('mk', $em)/@fr"/>
</xsl:for-each>
<xsl:value-of select="concat(' ', substring-after(., ' '))"/>
</xsl:copy>
</xsl:emplate>-- Martin Honnen http://msmvps.com/blogs/martin_honnen/
|

Cart



