Hi,
I have a problem with an XSL file that I use to show a XML file as a tree in my browser. The XML-file I use is:
And the XSL (downloaded from
I keep getting the content nodes (i.e., "block" and "inline") printed at the bottom of the output. I already experimented with templates to supress them, but without any succes. Any help would be greatly appreciated.
I have a problem with an XSL file that I use to show a XML file as a tree in my browser. The XML-file I use is:
Code:
<types title="types">
<frontpage id="1" title="frontpage">
<display id="2" title="display">block</display>
</frontpage>
<page id="3" title="page">
<display id="4" title="display">inline</display>
</page>
</types>
And the XSL (downloaded from
Code:
</html>
</xsl:template>
<!-- Show each tree line -->
<xsl:template match="*" mode="line">
<div class="Node">
<xsl:call-template name="graft"/>
<xsl:apply-templates select="." mode="item"/>
</div>
<xsl:apply-templates mode="line"/>
</xsl:template>
<!-- Show item displays for different element types -->
<xsl:template match="*" mode="item">
<xsl:value-of select="@title"/>
</xsl:template>
<!-- Templates used to generate the "stick stack" of
tree connectors -->
<xsl:template name="graft">
<!-- Generate ancestor connectors -->
<xsl:apply-templates select="ancestor::*" mode="tree"/>
<!-- Generate current-node connector -->
<xsl:choose>
<xsl:when test="following-sibling::*">
<img src="icons/tree_tee.gif"/>
</xsl:when>
<xsl:otherwise>
<img src="icons/tree_corner.gif"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Suppress ancestor connector for the top node -->
<xsl:template match="types" mode="tree"/>
<!-- Show ancestor connectors for all other node types -->
<xsl:template match="*" mode="tree">
<xsl:choose>
<xsl:when test="following-sibling::*">
<img src="icons/tree_bar.gif"/>
</xsl:when>
<xsl:otherwise>
<img src="icons/tree_spacer.gif"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
I keep getting the content nodes (i.e., "block" and "inline") printed at the bottom of the output. I already experimented with templates to supress them, but without any succes. Any help would be greatly appreciated.