|
Here is my sample XML
<?xml version="1.0" standalone="yes"?>
<NewDataSet>
<Table>
<empppgid>100002</empppgid>
<Name>Wyatt,Aasen</Name>
<email>aasen@ppg.com</email>
</Table>
<TableHeader>
<Name>Name</Name>
</TableHeader>
</NewDataSet>
Here is my sample XSL
<xsl:for-each select="NewDataSet">
<table border="1" cellpadding="0" cellspacing="1" width="100%" bordercolor="#CFCFCF">
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0" >
<xsl:variable name="bcolor" select="0"></xsl:variable>
<tr>
<xsl:for-each select="child::TableHeader">
<tr>
<xsl:for-each select="child::*">
<th align="left" class="theader">
<xsl:value-of select="name()">
</xsl:value-of>
</th>
</xsl:for-each>
</tr>
<tr>
<td><br></br></td>
</tr>
</xsl:for-each>
</tr>
<tr>
<td><br></br></td>
</tr>
<xsl:for-each select="Table">
<tr bgcolor="white">
<xsl:for-each select="child::*">
<td>
<xsl:value-of select="text()">
</xsl:value-of>
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
</td>
</tr>
</table>
I have attached XML and XSL code.My output has to be HTML after applying transformation. It should emit HTML elements only for the child Nodes in the <TableHeader> Tag.for e.g..My XML is given below.
Now <TableHeader> tag has two child node "Name" & "Function".So LastName & Email should not displayed in HTML
So the Html Output after passing the XPAth (NewDataSet/Tables)
1.Name
2.Function
|
|
|
|
|
|
|
|