XSL template does not match everything
<p>I have following XML:</p>

<pre><code>&lt;function&gt;
    &lt;success&gt;
        &lt;response code="200" name="Ok"&gt;
            &lt;content name="yellogUserId" type="long" /&gt;
            &lt;contents name="functionalAreas" type="Json[]"&gt;
                &lt;content name="functionalAreaId" type="long" /&gt;
                &lt;content name="functionalAreaName" type="String" /&gt;
                &lt;contents name="workPlaces" type="Json[]"&gt;
                    &lt;content name="workPlaceId" type="long" /&gt;
                    &lt;content name="workPlaceName" type="String" /&gt;
                &lt;/contents&gt;
            &lt;/contents&gt;
        &lt;/response&gt;
    &lt;/success&gt;
&lt;/function&gt;
</code></pre>

<p>I have a .xsl file which transforms the xml into a html file. The problem now is the CONTENT and CONTENTS node. These two can be indefinitly nested (CONTENT has no children, CONTENTS always has CONTENT as children but can also contain more CONTENTS). My XSL looks like this:</p>

<pre><code>&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;

&lt;xsl:output method="xml" indent="no" omit-xml-declaration="yes" /&gt;

&lt;xsl:template match="contents[content]"&gt;
    &lt;li&gt;
        &lt;xsl:value-of select="@name" /&gt; : &lt;xsl:value-of select="@type" /&gt;
        &lt;ul&gt;
            &lt;xsl:apply-templates select="content" /&gt;
        &lt;/ul&gt;
    &lt;/li&gt;
&lt;/xsl:template&gt;

&lt;xsl:template match="content"&gt;
    &lt;li&gt;&lt;xsl:value-of select="@name" /&gt; : &lt;xsl:value-of select="@type" /&gt;&lt;/li&gt;
&lt;/xsl:template&gt;

&lt;xsl:template match="/"&gt;
    &lt;div class="jumbotron"&gt;
        &lt;table class="table table-bordered"&gt;
            &lt;tr&gt;
                &lt;td class="tdleft"&gt;Success Response&lt;/td&gt;
                &lt;td class="tdright"&gt;
                    &lt;xsl:for-each select="function/success/response"&gt;
                        &lt;xsl:value-of select="@code" /&gt; - &lt;xsl:value-of select="@name" /&gt;
                        &lt;xsl:if test="content"&gt;
                            &lt;br/&gt;
                            Content:
                            &lt;ul&gt;
                                &lt;xsl:apply-templates select="content" /&gt;
                                &lt;xsl:apply-templates select="contents" /&gt;
                            &lt;/ul&gt;
                        &lt;/xsl:if&gt;
                        &lt;br/&gt;&lt;br/&gt;
                    &lt;/xsl:for-each&gt;
                &lt;/td&gt;
            &lt;/tr&gt;
        &lt;/table&gt;
    &lt;/div&gt;
&lt;/xsl:template&gt;

&lt;/xsl:stylesheet&gt;
</code></pre>

<p>What I get when I transform it is this:</p>

<pre><code>yellogUserId : long
functionalAreas : Json[]
    functionalAreaId : long
    functionalAreaName : String
</code></pre>

<p>But what I want is this:</p>

<pre><code>yellogUserId : long
functionalAreas : Json[]
    functionalAreaId : long
    functionalAreaName : String
    workPlaces : Json[]
        workPlaceId : long
        workPlaceName : String
</code></pre>

<p>The problem is, that it only matches the first layer, but doesn't go in deeper which is what I want it to do. (Sorry if this sounds kinda weird, I didn't know how to describe it better)</p>