Connecting Tech Pros Worldwide Help | Site Map

Transforming XML using XSLT in .Net

Newbie
 
Join Date: Jan 2008
Posts: 9
#1: Jan 28 '09
I have a problem in accessing the values while transforming an XML using XSLT
Expand|Select|Wrap|Line Numbers
  1. BODY {     FONT: x-small 'Verdana'; MARGIN-RIGHT: 1.5em } .c {     CURSOR: hand } .b {     FONT-WEIGHT: bold; COLOR: red; FONT-FAMILY: 'Courier New'; TEXT-DECORATION: none } .e {     MARGIN-LEFT: 1em; TEXT-INDENT: -1em; MARGIN-RIGHT: 1em } .k {     MARGIN-LEFT: 1em; TEXT-INDENT: -1em; MARGIN-RIGHT: 1em } .t {     COLOR: #990000 } .xt {     COLOR: #990099 } .ns {     COLOR: red } .dt {     COLOR: green } .m {     COLOR: blue } .tx {     FONT-WEIGHT: bold } .db {     MARGIN-TOP: 0px; PADDING-LEFT: 0.3em; MARGIN-BOTTOM: 0px; FONT: small Courier; MARGIN-LEFT: 1em; BORDER-LEFT: #cccccc 1px solid; TEXT-INDENT: 0px } .di {     FONT: small Courier } .d {     COLOR: blue } .pi {     COLOR: blue } .cb {     MARGIN-TOP: 0px; PADDING-LEFT: 0.3em; MARGIN-BOTTOM: 0px; FONT: small Courier; MARGIN-LEFT: 1em; COLOR: #888888; TEXT-INDENT: 0px } .ci {     FONT: small Courier; COLOR: #888888 } PRE {     DISPLAY: inline; MARGIN: 0px }  <?xml version="1.0" encoding="utf-8"  ?> 
  2.    <EmployeeInfo xmlns:xsi="]http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  3.      <EmployeeAddress xsi:nil="true" xmlns="http://xml.netquote.com/employee/types" /> 
  4.  
  5.     <IsEmployee xmlns="http://xml.netquote.com/employee/types">false</IsEmploye>  
  6.  
  7.     <NumberOfUsers  xmlns="http://xml.netquote.com/employee/types">0</NumberOfUsers> 
  8.  
  9.     <EmployeeType xsi:nil="true" xmlns="http://xml.netquote.com/employee/types" /> 
  10.  
  11.     <EmployeeNumber  xmlns="http://xml.netquote.com/employee/types">1119100010000</EmployeeNumber>
  12. </EmployeeInfo>
  13.  
MY XSLT
Expand|Select|Wrap|Line Numbers
  1. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  2.                 xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xml.netquote.com/employee/types" 
  3. >
  4.     <xsl:output method="xml" indent="yes"/>
  5.  
  6.   <xsl:template match="/">
  7.     <html>
  8.       <body>
  9.         <h1>Employee Listing</h1>
  10.         <table border="1">
  11.           <tr>
  12.             <th>EmployeeAddress</th>
  13.             <th>IsEmployee</th>
  14.             <th>NumberOfUsers</th>
  15.             <th>EmployeeNumber</th>
  16.           </tr>
  17.             <xsl:for-each select="EmployeeInfo">
  18.               <tr>
  19.                 <td>
  20.                   <xsl:value-of select="EmployeeAddress"/>
  21.                 </td>
  22.                 <td>
  23.                   <xsl:value-of select="IsEmployee"/>
  24.                 </td>
  25.                 <td>
  26.                   <xsl:value-of select="NumberOfUsers"/>
  27.                 </td>
  28.                 <td>
  29.                   <xsl:value-of select="EmployeeNumber"/>
  30.                 </td>
  31.               </tr>
  32.             </xsl:for-each>          
  33.         </table>
  34.       </body>
  35.     </html>
  36. </xsl:template>
  37. </xsl:stylesheet>
Here when i transform i am not getting any values in the browser. When i get the values i need to assign it to dataset.

Thankyou
Reply