My Account   Contact Us    
  
» HomeProductsSupportDeveloper CommunityCompany
XML Employee Code Sample
Author: Narendra Bute
Category: XML
To store the value in XML and To display it on Web page through XSLT.
XML File Code:

<?xml version="1.0" encoding="utf-8" ?>

<PrakashFinancial>

<Employee ID="1" Name="Sid" />

<salary sal="3000"></salary>

<Employee ID="2" Name="Bob" />

<salary sal="4000"></salary>

<Employee ID="3" Name="Rao" />

<salary sal="5000"></salary>

<Employee ID="4" Name="Jack" />

<salary sal="6000"></salary>

<Employee ID="5" Name="David" />

<salary sal="7000"></salary>

<Employee ID="6" Name="Narendra" />

<salary sal="8000"></salary>

<Employee ID="8" Name="Rakesh" />

<salary sal="9000"></salary>

</PrakashFinancial>

XSL Code:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:output method="html" encoding="utf-8"/>

<xsl:template match="/PrakashFinancial/index.html">

<xsl:text>

List of Employees :

</xsl:text>

<xsl:apply-templates/>

</xsl:template>

<xsl:template match="/PrakashFinancial/Employee/index.html">

<br></br>

<xsl:value-of select="@Name"/>

</xsl:template>

<xsl:template match="/PrakashFinancial/salary/index.html">

<xsl:value-of select="@sal"/>

</xsl:template>

</xsl:stylesheet>

Code in TestPage (Web Page):

Xml1.DocumentSource = "/code_samples/codecfm/CodeID/140/XML/XML_Employee_Code_Sample/XMLFile1.xml"

Xml1.TransformSource = "XSLTFile1.xslt"



Content Management Powered by ActivEdit  ActivEdit Browser Based WYSIWYG HTML Editor

More Code Samples

Sign up for our newsletter: | Subscribe with RSS: RSS
© ActivSoftware 1999 to 2005 | Privacy Statement