XML:
I want the output like this:
type1
a
b
type2
c
I thought I could simply look at the previous sibling to and only output a heading if its type is different to the current one.
XSL:
This doesnt work. How come?
Code:
<project>
<task>
<name>a</name>
<type>type1</type>
</task>
<task>
<name>b</name>
<type>type1</type>
</task>
<task>
<name>c</name>
<type>type2</type>
</task>
</project>
type1
a
b
type2
c
I thought I could simply look at the previous sibling to and only output a heading if its type is different to the current one.
XSL:
Code:
<xsl:for-each select="project/task">
<xsl:if test="type!=string(preceding-sibling::type)">
<h2><xsl:value-of select="type" /></h2>
</xsl:if>
<p><xsl:value-of select="TaskName" /></p>
</xsl:for-each>
This doesnt work. How come?