xslt - what is the XSL to convert the following xml to another xml -


i have xml file of below format:

 -<table>       <a>         <a>x</a>         <b>y</b>       </a>        <b>        ...        ...        ....       </b>        <c>        ...        ...        ...        </c>     </table> 

i want make "a" root node instead of table. there way code in xsl above xml looks below?

 <a a="x" b="y">       <b>       ...       ...       ...      </b>       <c>       ...       ...       ...      </c>      </a> 

try

<xsl:template match="table">   <a>    <xsl:for-each select="a/*">     <xsl:attribute name="{local-name()}">      <xsl:value-of select="."/>     </xsl:attribute>    </xsl:for-each>    <xsl:copy-of select="*[not(self::a)]"/>  </a> </xsl:template> 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -