Home arrow XML arrow Page 4 - Designing Your Own Reporting Service: A Web Service to Convert XML to HTML Using XSL
XML

Designing Your Own Reporting Service: A Web Service to Convert XML to HTML Using XSL


This article guides you in developing a web service which converts a given XML string to HTML based on XSL file available at server side.

Author Info:
By: Jagadish Chaterjee
Rating: 4 stars4 stars4 stars4 stars4 stars / 11
December 19, 2005
TABLE OF CONTENTS:
  1. · Designing Your Own Reporting Service: A Web Service to Convert XML to HTML Using XSL
  2. · Developing the XML Web Service
  3. · Developing the XML Web Service continued
  4. · Defining the XSLT
  5. · Executing and testing the XML Web Service
  6. · Understanding the web service
  7. · Improvements to the solution

print this article
SEARCH DEVARTICLES

Designing Your Own Reporting Service: A Web Service to Convert XML to HTML Using XSL - Defining the XSLT
(Page 4 of 7 )

Create a new XSLT file within the same project with the name “sample.xsl”.  Make certain that you need to modify the “web.config” file (as specified above), if you store the same file in a different path or with a different file name.  Modify the content within the “sample.xsl” file, so that it looks exactly the same as the following:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:msxsl="urn:schemas-microsoft-com:xslt"
      xmlns:teletext="teletext.co.uk" version="1.0">
      <xsl:template match="/">
            <html>
                  <body>
                        <table border="1">
                        <theader>
                              <tr>
                              <th>Product ID</th>
                              <th>Product Name</th>
                              </tr>
                        </theader>
                              <tbody>
                              <xsl:for-each select="Products/Product">
                                    <tr>
                                          <td>
                                                <xsl:value-of select="idproduct" />
                                          </td>
                                          <td>
                                                <xsl:value-of select="productname" />
                                          </td>
                                    </tr>
                              </xsl:for-each>
                              </tbody>
                        </table>
                  </body>
            </html>
      </xsl:template>
</xsl:stylesheet>

You can find the above XSL code in the “sample.xsl” file within the downloadable zip.  If you are very new to XSL (and cannot understand the above), you will want to go through my previous article “Applying XSLT to XML Using ASP.NET”, which discusses almost the same type of XSL.


blog comments powered by Disqus
XML ARTICLES

- Open XML Finally Supported by MS Office
- XML Features Added to Two Systems
- Using Regions with XSL Formatting Objects
- Using XSL Formatting Objects
- More Schematron Features
- Schematron Patterns and Validation
- Using Schematron
- Datatypes and More in RELAX NG
- Providing Options in RELAX NG
- An Introduction to RELAX NG
- Path, Predicates, and XQuery
- Using Predicates with XQuery
- Navigating Input Documents Using Paths
- XML Basics
- Introduction to XPath

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials