Hi All,
I am new to XSLT.
I have the following XML file:
<?xml version="1.0" ?>
<?xml-stylesheet type="text/xsl" href="address.xsl"?>
<!DOCTYPE address-book SYSTEM "address.dtd">
<address-book>
<entry>
<name>ABC</name>
<email href = "
[email protected]" />
</entry>
<entry>
<name>XYZ</name>
<email href = "
[email protected]" />
</entry>
</address-book>
My XSL file for the same is:
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0">
<xsl:template match = "/" >
<html>
<body>
<table border = "1" cellspacing = "0" cellpadding = "0">
<xsl:apply-templates />
</table>
</body>
</html>
</xsl:template>
<xsl:template match = "*" >
<xsl:apply-templates />
</xsl:template>
<xsl:template match = "address-book/entry" >
<xsl:apply-templates />
</xsl:template>
<xsl:template match = "name">
<tr>
<td>Name</td>
<td>
<b><xsl:value-of select = "." /></b>
</td>
</tr>
</xsl:template>
<xsl:template match = "email">
<tr>
<td>Email</td>
<td>
<xsl:value-of select = "." />
</td>
</tr>
</xsl:template>
</xsl:stylesheet>
I want Name and Email to be displayed in the table. Name is getting displayed but since Email is specified as an attribute, I am unable to display it. Is there any way by which I can display the value of an attribute?