I'm using XSLT to transform from one format of XML into another but I also need to do some value substitutions at the same time if possible. Can someone provide a solution to change a large number of values; e.g. "AppName" should be changed to "1", "AppNameTwo" to "2" and I'd ideally like to do this via some type of look-up lists within the XSLT:
<Application>
<oldvalue="AppName" replacewith="1">
<oldvalue="AppNameTwo" replacewith="2">
</Application>
<ResponseOne>
<oldvalue="True" replacewith="Okay">
<oldvalue="False" replacewith="Error">
</ResponseOne>
The only way I can currently think of doing this is instead via a number of many nested replaces?
Input
<Message>
<Header>
<Application>AppName</Application>
<ResponseOne>True</ResponseOne>
...
</Header>
</Message>
XSLT so far
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0">
<xsl:template match="/">
<n1:Message>
<Header>
<Application><xsl:value-of select="//Message/Organisation/Application/Name"/> </Application>
<Response><xsl:value-of select="//Message/Organisation/Application/ResponseOne"/> </Response>
...
</Header>
</n1:Message>
Required Output
<?xml version="1.0" encoding="utf-8"?>
<n1:Message>
<Header>
<Application>1</Application>
<Response>Error</Response>
...
</Header>
</n1:Message>
Intending to run this XSLT within Visual Studio 2010.