Monday, 30 September 2013

how to change attribute values using xsl

how to change attribute values using xsl

im still learning xsl and i'm trying to change the value im getting from
the xsl to another value. (im using xsl to convert my xml to another xml)
xml
<?xml version="1.0" encoding="UTF-8"?>
<Person>
<Info Name="Jen" Age="20" Class="C" />
</Person>
xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:template match="/">
<Person>
<lookuptable>
<name first="Jen" ori="Jenny" />
<name first="Sam" ori="Sammy" />
</lookuptable>
<xsl:for-each select="Person">
<Info Name="{Info/@Name}" Age="{Info/@Age}" Class="{Info/@Class}" />
</xsl:for-each>
</Person>
</xsl:template>
</xsl:stylesheet>
i created a lookuptable. {Info/@Name} gives me "Jen" in the converted
xml(using xsl) i want to change it to "Jenny" using table but i dont know
how to do it. thanks in advance..

No comments:

Post a Comment