Page 1 of 1 |
|
Posted: Tue, 17th Aug 2010 01:01 Post subject: XML to HTML |
|
 |
Is there some kind of xml converter which converts xml into html? And equipped with the option of generating the xls stylesheet and the script used in order to generate the html file. I'm not looking for a complex html page. Not at all. Just to be able to generate an html table but with the ability to output the files I mentioned.
|
|
Back to top |
|
 |
|
Posted: Tue, 17th Aug 2010 01:03 Post subject: |
|
 |
I couldn't think of an easier way than creating an xslt stylesheet. What's your problem with xslt? 
|
|
Back to top |
|
 |
|
Posted: Tue, 17th Aug 2010 01:09 Post subject: |
|
 |
I'm not much into xml stuff, but here's the situation:
1) I have an xml file.
2) I've written the xsl transformation stylesheet for the above xml file.
3) Then I'm using altova xmlspy (popular xml editor) to connect the xml and xsl files and to produce the html output (a simple html table).
But the html file represents just the construction of the table and the contents in it. How can I see what script is used to generate the html file?
I just don't understand how to use xml and xsl files to generate the html one.
|
|
Back to top |
|
 |
|
Posted: Tue, 17th Aug 2010 01:20 Post subject: |
|
 |
Here your basic XSLT, lets call it "transform.xslt":
Code: | <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template name="mainTemplate" match="*" priority="10">
<table>
<xsl:for-each select="row">
<tr>
<xsl:for-each select="column">
<td>
<xsl:value-of select="." />
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet> |
And this should be your xml file:
Code: | <?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="transform.xslt" type="text/xsl"?>
<RootTable>
<row>
<col>fuuu</col>
</row>
</RootTable> |
As you can see the stylesheet that is used to transform and display is specified in there.
If you don't like this solution you could still use javascript to load the xml file and transform the content with the xsl file, but you still only need the two files above if you just want to transform xml to html 
|
|
Back to top |
|
 |
|
|
Back to top |
|
 |
|
|
Back to top |
|
 |
|
Posted: Tue, 17th Aug 2010 12:10 Post subject: |
|
 |
No problem If you still want to see the produced HTML code, just open up firebug and you'll see the resulting source code.
|
|
Back to top |
|
 |
|
|
Back to top |
|
 |
|
|
Back to top |
|
 |
|
Posted: Tue, 17th Aug 2010 14:31 Post subject: |
|
 |
oh good, I'm sure it was pretty easy to accomplish right? (ofc depending on the initial xml files complexity )
|
|
Back to top |
|
 |
|
Posted: Tue, 17th Aug 2010 14:35 Post subject: |
|
 |
human_steel wrote: | P.S. Thanks again, Pump, for the firebug suggestion.  |
We VIP members don't get paid ( ) to just look good!
|
|
Back to top |
|
 |
Page 1 of 1 |
All times are GMT + 1 Hour |