XML to HTML
Page 1 of 1
human_steel




Posts: 33269

PostPosted: 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
PumpAction
[Schmadmin]



Posts: 26759

PostPosted: 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? Smile


=> NFOrce GIF plugin <= - Ryzen 3800X, 16GB DDR4-3200, Sapphire 5700XT Pulse
Back to top
human_steel




Posts: 33269

PostPosted: 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
PumpAction
[Schmadmin]



Posts: 26759

PostPosted: 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 Smile


=> NFOrce GIF plugin <= - Ryzen 3800X, 16GB DDR4-3200, Sapphire 5700XT Pulse
Back to top
human_steel




Posts: 33269

PostPosted: Tue, 17th Aug 2010 01:34    Post subject:
Exxuse me for my somewhat stupidity, but then when I've created the two files with the link of the xsl file in the xml file, how do I produce the html file (without any other program)?
I know I'm being a derp right now ... Sad
Back to top
human_steel




Posts: 33269

PostPosted: Tue, 17th Aug 2010 11:29    Post subject:
Oh, fucking god. I'm so stupid. It worked. Thanks a million, Pump. Smile
Back to top
PumpAction
[Schmadmin]



Posts: 26759

PostPosted: Tue, 17th Aug 2010 12:10    Post subject:
No problem Smile If you still want to see the produced HTML code, just open up firebug and you'll see the resulting source code.


=> NFOrce GIF plugin <= - Ryzen 3800X, 16GB DDR4-3200, Sapphire 5700XT Pulse
Back to top
human_steel




Posts: 33269

PostPosted: Tue, 17th Aug 2010 14:06    Post subject:
Here's another one. How do I convert an xml file into a simple txt file? I just want to have all the information contained in the xml file extracted without any formatting whatsoever.
P.S. Thanks again, Pump, for the firebug suggestion. Smile
Back to top
human_steel




Posts: 33269

PostPosted: Tue, 17th Aug 2010 14:26    Post subject:
Nevermind, figured it out. Laughing
Back to top
PumpAction
[Schmadmin]



Posts: 26759

PostPosted: Tue, 17th Aug 2010 14:31    Post subject:
oh good, I'm sure it was pretty easy to accomplish right? Smile (ofc depending on the initial xml files complexity Very Happy )


=> NFOrce GIF plugin <= - Ryzen 3800X, 16GB DDR4-3200, Sapphire 5700XT Pulse
Back to top
PumpAction
[Schmadmin]



Posts: 26759

PostPosted: Tue, 17th Aug 2010 14:35    Post subject:
human_steel wrote:
P.S. Thanks again, Pump, for the firebug suggestion. Smile


We VIP members don't get paid () to just look good!


=> NFOrce GIF plugin <= - Ryzen 3800X, 16GB DDR4-3200, Sapphire 5700XT Pulse
Back to top
Page 1 of 1 All times are GMT + 1 Hour
NFOHump.com Forum Index - Applications
Signature/Avatar nuking: none (can be changed in your profile)  


Display posts from previous:   

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2.0.8 © 2001, 2002 phpBB Group