How to Use XSL to publish entire XML node, including tags, to HTML?

Posted on 2005-05-05
Last Modified: 2013-12-25
I want to publish everything in the <border ID="top"> node of the XML Document below to html using the xsl sytlesheet below, including the tags. As it is now, I have three borders hard coded into the xsl document, and I'm going to have at least 10 different xsl files, so it's much easier to edit the XML than cut and paste ad infinitum.  What is the easiest and/or best way to use the xsl to do this?

<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl"?>
        <BORDER id="top">
            <table border="0" width="812">
                    <td width="180">
                      <a href="test2.htm">
                        <img src="images/apahome.gif"></img>
                    <td valign= "center" align="center" width="618">
                      <img src= "images/apa_logo_sm.jpg" width="50" height="35"></img>
                        <font size="7"> San Gabriel Valley APA </font>
                      <img src= "images/apa_logo_sm.jpg" width="50" height="35"></img>
        <BORDER id="left">
        <BORDER id="bottom">

XSL stylesheet
<?xml version="1.0" encoding="iso-8859-1" ?>
- <xsl:stylesheet version="1.0" xmlns:xsl="">
- <xsl:template match="/">
- <html>
- <head>
  <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
  <meta name="copyright" content="" />
  <meta name="author" content="" />
- <body link="#0000FF" vlink="#0000FF" alink="#FF0000">
- <!--   table 1  -->

- <!--  WHAT GOES HERE?   -->

- <!--  table 2  -->
  <table border="0" width="800">

ASP File
<%@ LANGUAGE = JavaScript %>
  sXSL = "test.xsl"
  // Set the source and style sheet locations here
  var sourceFile = Server.MapPath("apa.xml");
  var styleFile = Server.MapPath(sXSL);

  // Load the XML
  var source = Server.CreateObject("Msxml2.DOMDocument");
  source.async = false;
  source.resolveExternals = false

  // Load the XSLT
  var style = Server.CreateObject("Msxml2.DOMDocument");
  style.async = false;
  style.resolveExternals = false
Question by:racing_chicken

    Author Comment

    Is this question too wierd, too stupid or is no one listening?

    I realize there are other ways to do this by making the XML Doc a little more normal, but the XML is well-formed and if it could be done, it would be a tremendous timesaver. I doubt I could write a DTD or schema for it, though.
    LVL 53

    Accepted Solution

    Well it is possible that no one understands what it is you are trying to do; or the experts looking at the authorig topic are not XML experts; or they are trying to figure out the connection between the xsl and the client side scripting being generated by the server side script.

    My xml skills re pretty limited but if what you ae trying to do is preserve the formatting of the block could you not just put it in a CDATA section?

    I think you might be wise to post a pointer to this thread in the XML topic to get experts that may be better equipt to address your problem.


    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Verify person is in the US 6 91
    Automatic Image Uploading 9 52
    Lines Not Lining Up 2 33
    Pick image, show data 4 25
    Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
    I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
    This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now