how to use xsl to change this xml format

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • 989qazxsw
    New Member
    • Sep 2010
    • 1

    how to use xsl to change this xml format

    can i use xsl to change this format

    Code:
      <rr n="Address">
      <tt>
      <j n="currentAddress">0</j> 
      <j n="city">city</j> 
      </tt>
      </rr>
    to this :-

    Code:
      <Address>
      <tt>
      <currentAddress>0</currentAddress> 
      <city>city</city> 
      </tt>
      <Address>
    notice that i want the attribute value to become the element and remove the attribute if possible please post method.

    thank you
    Last edited by Dormilich; Sep 21 '10, 10:25 PM. Reason: please use [code] [/code] tags (#) when posting code
  • jkmyoung
    Recognized Expert Top Contributor
    • Mar 2006
    • 2057

    #2
    Use braces to indicate attribute value templates:
    Code:
    <xs:template match="rr">
      <xs:element name="{@n}">
         <xsl:apply-templates/>
       ...
    ...

    Comment

    Working...