Subject: Re: [xsl] Hash / Translation Tables (the right way) From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Sun, 25 Sep 2011 18:40:25 -0400 |
Another approach is to have a document months.xml
<months> <month name='January' abbr='jan' num='01'/> <month name='February' abbr='feb' num='02'/> ... </months>
then
document('months.xml')/months/month[@abbr=lower-case($mon)]/@num
(or instead of a separate document you can put the lookup table in a global variable in the stylesheet; but with XSLT 1.0 this relies on the node-set() function.)
<hank:months> <month name='January' abbr='jan' num='01'/> <month name='February' abbr='feb' num='02'/> ... </hank:months>
-- Contact us for world-wide XML consulting and instructor-led training Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Google+ profile: https://plus.google.com/116832879756988317389/about Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Hash / Translation Tables, Michael Kay | Thread | Re: [xsl] Hash / Translation Tables, G. Ken Holman |
Re: [xsl] Client-side XSLT, Michael Kay | Date | Re: [xsl] Hash / Translation Tables, G. Ken Holman |
Month |