I want to change this code
<?xml version="1.0" encoding="UTF-8"?>
<xml>
<file id="Tokw" cast="ind">
<name>Token wst</name>
<package>b_3</package>
<package>c_5</package>
</file>
<file id="strlin" cast="bac">
<name>str line</name>
<package>b_2</package>
<package>c_5</package>
<package>a_2</package>
</file>
and so on, to this code:
<md_db>
<ID>1</ID> //auto numeration
<file_id>Tokw</package_id>
<cast>ind</cast>
<name>Token wst</name>
<package>b_3 c_5</package>
</md_db>
<md_db>
<ID>2</ID>
<file_id>stlin</file_id>
<cast>bac</cast>
<name>str line</name>
<package>b_2 c_5 a_2</package>
</md_db>
What xsl use to change this XML file? It is breaking up first line file id, and if there are packages it has to collect them up into one node package. There is also ID which doesn't have to be auto numerated, but there have to be one number.
I have this code yet:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output indent="yes"/>
<xsl:template match="xml">
<md_db>
<ID></ID>
<file><xsl:value-of select="file id"/></file>
<cat><xsl:value-of select="cat"/></cat>
<name><xsl:value-of select="name"/></name>
<xsl:if test="package">
<package><xsl:value-of select="package"/></package>
</xsl:if>
</md_db>
</xsl:template>
</xsl:stylesheet>