Of all my googling I can't seem to find how this can be done (plus I'm such a newb when it comes to xslt). I'm trying to take a flat sitemap.xml file and have nested children if the url path dictates.
Sample sitemap
<sitemap>
<url>
    <loc>https://example.com/</loc>
    <lastmod>2022-02-28</lastmod>
    <changefreq>monthly</changefreq>
    <priority>0.5</priority>
</url>
<url>
    <loc>https://example.com/athletics/index.html</loc>
    <lastmod>2022-02-28</lastmod>
    <changefreq>monthly</changefreq>
    <priority>0.5</priority>
</url>
<url>
    <loc>https://example.com/athletics/colleges-schools.html</loc>
    <lastmod>2022-02-28</lastmod>
    <changefreq>monthly</changefreq>
    <priority>0.5</priority>
</url>
<url>
    <loc>https://example.com/training/index.html</loc>
    <lastmod>2022-02-28</lastmod>
    <changefreq>monthly</changefreq>
    <priority>0.5</priority>
</url>
<urls>....</urls>
</sitemap>
I either want to ultimately have it something like this
<sitemap>
<url>
    <loc>https://example.com/</loc>
    <lastmod>2022-02-28</lastmod>
    <changefreq>monthly</changefreq>
    <priority>0.5</priority>
    <children>
        <url>
            <loc>https://example.com/athletics/index.html</loc>
            <lastmod>2022-02-28</lastmod>
            <changefreq>monthly</changefreq>
            <priority>0.5</priority>
            <children>
                <url>
                    <loc>https://example.com/athletics/colleges-schools.html</loc>
                    <lastmod>2022-02-28</lastmod>
                    <changefreq>monthly</changefreq>
                    <priority>0.5</priority>
                </url>
            </children>
        </url>
        <url>
            <loc>https://example.com/training/index.html</loc>
            <lastmod>2022-02-28</lastmod>
            <changefreq>monthly</changefreq>
            <priority>0.5</priority>
        </url>
    </children>
</url>
</sitemap>
or converted to a .json, but I have learned how to convert an xml to json quite easily, so I just really need to understand how I can regex (or something) into the <loc> field and generate children based of /XX_name_XX/