This is my xslt code
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="xslTutorial">
<xsl:apply-templates select="xslTutorial"/>
</xsl:template>
<xsl:template match="xslTutorial">
<p>
SUMMERY:<xsl:value-of select="SECTION/SUMMARY"/>
<br>
<xsl:choose>
<xsl:when test="position()=2">
DATA:<xsl:value-of select="SECTION/DATA"/>
</xsl:when>
</xsl:choose>
</br>
</p>
</xsl:template>
</xsl:stylesheet>
Here is the xml code:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="C:\Users\Semsema\Desktop\Day 3-XML\ex2.xslt"?>
<xslTutorial>
<SECTION>
<SUMMARY>I need a pen and some paper</SUMMARY>
<DATA>I need a pen.</DATA>
<DATA>I need some paper.</DATA>
</SECTION>
<SECTION>
<DATA>I need bread.</DATA>
<DATA>I need butter.</DATA>
</SECTION>
</xslTutorial>
and i want the output to be:
SUMMARY: I need a pen and some paper
DATA: I need bread.
DATA: I need butter.
How can i do this? (what the wrong in xslt code?)