I have following XML:
<function>
<success>
<response code="200" name="Ok">
<content name="yellogUserId" type="long" />
<contents name="functionalAreas" type="Json[]">
<content name="functionalAreaId" type="long" />
<content name="functionalAreaName" type="String" />
<contents name="workPlaces" type="Json[]">
<content name="workPlaceId" type="long" />
<content name="workPlaceName" type="String" />
</contents>
</contents>
</response>
</success>
</function>
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:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="no" omit-xml-declaration="yes" />
<xsl:template match="contents[content]">
<li>
<xsl:value-of select="@name" /> : <xsl:value-of select="@type" />
<ul>
<xsl:apply-templates select="content" />
</ul>
</li>
</xsl:template>
<xsl:template match="content">
<li><xsl:value-of select="@name" /> : <xsl:value-of select="@type" /></li>
</xsl:template>
<xsl:template match="/">
<div class="jumbotron">
<table class="table table-bordered">
<tr>
<td class="tdleft">Success Response</td>
<td class="tdright">
<xsl:for-each select="function/success/response">
<xsl:value-of select="@code" /> - <xsl:value-of select="@name" />
<xsl:if test="content">
<br/>
Content:
<ul>
<xsl:apply-templates select="content" />
<xsl:apply-templates select="contents" />
</ul>
</xsl:if>
<br/><br/>
</xsl:for-each>
</td>
</tr>
</table>
</div>
</xsl:template>
</xsl:stylesheet>
What I get when I transform it is this:
yellogUserId : long
functionalAreas : Json[]
functionalAreaId : long
functionalAreaName : String
But what I want is this:
yellogUserId : long
functionalAreas : Json[]
functionalAreaId : long
functionalAreaName : String
workPlaces : Json[]
workPlaceId : long
workPlaceName : String
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)