File: Data.xml
<?xml version="1.0"?>
<countries>
<country name="France" />
<country name="Germany" />
<country name="Israel" />
<country name="Japan" />
<country name="Poland" />
<country name="United States" selected="yes" />
<country name="Venezuela" />
</countries>
File: Transform.xslt
<?xml version="1.0"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="schema-version" select="4.0" />
<xsl:template match="/">
<promotion>
<xsl:variable name="attname"
select="if ($schema-version lt 3.0)
then 'code'
else 'reason-code'" />
<xsl:attribute name="{$attname}" select="17" />
</promotion>
</xsl:template>
</xsl:stylesheet>
Output:
<?xml version="1.0" encoding="UTF-8"?><promotion reason-code="17"/>
|