This code:
<xsl:template match="main/sec/p">
<xsl:for-each select="/main/sec/p">
says that whenever you find a main/sec/p element you want to process all the main/sec/p elements. You don't want that.
This code:
<xsl:value-of select="main/sec/p"/>
says "starting at the context node" (which is a p element) select the main children, then the sec grandchildren, then the p greatgrandchildren." Your p elements don't have any main children, so this will select nothing.
Read about path expressions and the importance of the context node.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference