check and print nodes in xslt



Partial XML



<Notes>
<Note>Line 1</Note>
<Note>Line 2</Note>
<Note>Line 2</Note>
</Notes>


Partial XSLT



<xsl:for-each select="/Notes/Note">
<xsl:value-of select=".">
</xsl:value-of>
</xsl:for-each>


Output:



Line 1
Line 2
Line 3


I want to be able to print only the first two lines. Or a message stating "No Notes". But, I don't understand how to count exactly two or check for a lack of any elements.


No comments:

Post a Comment