Entry
XML: XSL: HTML: Output: View: How to view the generated HTML source code from .XSL and .XML file?
Sep 16th, 2003 08:59
Knud van Eeden,
----------------------------------------------------------------------
--- Knud van Eeden --- 10 September 2003 - 04:31 pm ------------------
XML: XSL: HTML: Output: View: How to view the generated HTML source
code from .XSL and .XML file?
---
When using XSL you will soon find out that it is from rather difficult
to very difficult, to follow what exactly is happening.
It is a bit like having to unravel the inner working of a black box,
and can be very time consuming to get it right.
---
Looking at the generated HTML source code (as a result of combining
your XML and XSL input files) is one strategy which very certainly will
help you giving you debugging feedback of your changes in the XSL and
or XML file(s).
---
If you right click on the HTML page generated by your XML and XSL, you
will quickly find out that you do *not* see the HTML source code, but
instead the XML code which generated it.
---
Though it is possible to use e.g. JavaScript functions (=transformNode)
and or e.g. XMLSpy (note that XMLSpy v2004 has extensive debugging
possibilities for XSL, and also a stylesheet designer to generate
the XSL source to create e.g. HTML tables (also an art on itself)) to
generate HTML from your given XML and XSL, this generating, loading and
editing of the generated HTML can not really completely be automated in
combination with your favorite text or program editor (which you use as
the editor for your XML, XSL and HTML code), or only after possibly
considerable efforts of your side.
---
Using Microsoft 'msxsl.exe' with parameters is one of the easiest way I
have come across to solve this problem of having a look at the
generated HTML source code.
---
Method: use Microsoft msxsl
Download the free msxsl.exe program.
Then view your source code by using:
msxsl.exe <your xml filename> <your xsl filename> -o <your HTML
filename>
---
e.g.
msxsl.exe book.xml book.xsl -o myhtmlsourcecode.htm
---
---
Method: use JavaScript
Use in e.g. JavaScript the DOM-method 'transformNodeToObject'
Internet: see also:
http://www.faqts.com/knowledge_base/view.phtml/aid/11672
---
---
Method: use XMLSpy
Using e.g. a program like XMLSpy v3.5, XMLSpy v4, XMLSpy v2004, ...
http://www.xmlspy.com
you can see the HTML output source code generated
(if you should look at the source code generated in say your Microsoft
Internet browser v5.0 or higher, you will see only the original XML
code instead).
You can then copy/paste this source code from XMLSpy and check and or
change this code by hand.
---
In XMLSpy v3.5:
Steps: Overview:
1. -open the corresponding XML, XSL (and possibly DTD or XSD file)
2. -click on the .xml file (in order to put the focus on it)
3. -select from menu option 'XSL'
4. -select from list 'XSL transformation'
5. -this will open a new window
6. -right click on the screenarea of this window
(the window with bottom tab showing 'XSL Output.HTML')
7. -select from list 'View Source'
8. -this will show the generated HTML source code
----------------------------------------------------------------------