I am assuming the hierarchy is exactly the given three levels deep. It would be hard for it to be otherwise, if each level requires an element with its own name. For this reason also, it is necessary to have a separate template for each level, even though the code is largely similar. Otherwise we would need some sort of a lookup directory to find out what comes after "month", for example.
(edit)
It is also assumed that each data element - other than a year - has a "parent" data element; i.e. no intermediate elements have to be created during the transformation.
XSLT 1.0
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/root">
<xsl:copy>
<xsl:apply-templates
select="data[not(contains(., '/'))]"
mode="year"/>
</xsl:copy>
</xsl:template>
<xsl:template match="data" mode="year">
<year value="{.}">
<xsl:variable name="dir" select="concat(., '/')" />
<xsl:apply-templates
select="/root/data
[starts-with(., $dir)]
[not (contains(substring-after(., $dir), '/'))]"
mode="month"/>
</year>
</xsl:template>
<xsl:template match="data" mode="month">
<month value="{substring-after(., '/')}">
<xsl:variable name="dir" select="concat(., '/')" />
<xsl:apply-templates
select="/root/data
[starts-with(., $dir)]
[not (contains(substring-after(., $dir), '/'))]"
mode="day"/>
</month>
</xsl:template>
<xsl:template match="data" mode="day">
<day value="{substring-after(substring-after(., '/'), '/')}">
</day>
</xsl:template>
</xsl:stylesheet>
When applied to your input, the result is:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<year value="2013">
<month value="1">
<day value="0"/>
<day value="1"/>
<day value="2"/>
</month>
<month value="2">
<day value="0"/>
<day value="1"/>
<day value="2"/>
<day value="3"/>
</month>
</year>
</root>
Where the info elements would be info I get about each path from
somewhere else.
I left this part out because it's not at all clear to me how this would work. I hope you won't be disappointed when you get to it.