That's my source file(that can't be changed)
<root>
<status> status </status>
<content>
<Description>
<title>Title </title>
<some_node>some node </some_node>
</Description>
</content>
</root>
Sometimes I need title to be displayed before status. That's my code:
<xsl:stylesheet>
<xsl:param name="TitleOnTop" select="'true'"/>
<xsl:template match="root">
<xsl:if test="$TitleOnTop='true'">
<xsl:apply-templates select="//title[1]"></xsl:apply-templates>
</xsl:if>
<xsl:choose>
<xsl:when test="$TitleOnTop='true'">
<xsl:apply-templates select="*[not(self::title)]"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="title">
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
The problem is that title is displayed twice. I searched for solution of how to exclude template from aplly-template, but nothing seems to work, title is still displayed both before and after status. How do I fix that?
Output I get :
Title status Title
some node
Output I want:
Title status
some node