Transform XML in another format

Questions about XML that are not covered by the other forums should go here.
gourou76
Posts: 4
Joined: Sun Jul 31, 2005 12:32 am

Transform XML in another format

Post by gourou76 » Sun Jul 31, 2005 12:33 am

Greetings,

I am not a programmer, so when I encounter the type of problem that I will expose, I am ever so grateful 

I have a report per machine and the report can only be saved in XML.

I would like to now convert the report in whatever, HTML, DOC, PDF, spreadsheet etc. The issue is that I need to be able to exploit it.

I have posted the report on my site:

http://www.cisware.co.uk/xmlproblem it’s only 20 K

Anybody could give me a tool to just convert this thing? I am fluent in English/French….

Best wishes,
Jimmy

george
Site Admin
Posts: 2101
Joined: Thu Jan 09, 2003 2:58 pm

Post by george » Mon Aug 01, 2005 10:00 am

Hi Jimmi,

A simple stylesheet as below will give you HTML:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="NewDataSet">
<html>
<table border="1">
<xsl:apply-templates select="Table[1]" mode="header"/>
<xsl:apply-templates select="Table"/>
</table>
<table border="1">
<xsl:apply-templates select="Table1[1]" mode="header"/>
<xsl:apply-templates select="Table1"/>
</table>
<table border="1">
<xsl:apply-templates select="Table2[1]" mode="header"/>
<xsl:apply-templates select="Table2"/>
</table>
</html>
</xsl:template>

<xsl:template match="Table|Table1|Table2" mode="header">
<tr><xsl:apply-templates mode="header"/></tr>
</xsl:template>
<xsl:template match="*" mode="header">
<th><xsl:value-of select="name()"/></th>
</xsl:template>

<xsl:template match="Table|Table1|Table2">
<tr><xsl:apply-templates/></tr>
</xsl:template>
<xsl:template match="*">
<td><xsl:value-of select="."/></td>
</xsl:template>
</xsl:stylesheet>
Best Regards,
George

gourou76
Posts: 4
Joined: Sun Jul 31, 2005 12:32 am

Post by gourou76 » Mon Aug 01, 2005 10:46 am

Hey George

Thanks a million for stepping in!

I have saved the code as a .xml file. thanks again. Is there a way of automaticaly convert XML + your style sheet to HTML?

Have a good week indeed!
Jimmy :D

george
Site Admin
Posts: 2101
Joined: Thu Jan 09, 2003 2:58 pm

Post by george » Mon Aug 01, 2005 11:05 am

Hi Jimmy,

You should save that as XSL. Then you can use oXygen to transform your XML data with this stylesheet. The simplest thing is to have your XML and the styelsheet open, change to the XSLT Debugger perspective and use the Run to end action to get the output. Otherwise it is also quite simple to set up a transformation scenario in oXygen to do this processing. Also if you check the documentation for your preferred XSLT processor you will find how to do that from command line.

Best Regards,
George

gourou76
Posts: 4
Joined: Sun Jul 31, 2005 12:32 am

Post by gourou76 » Mon Aug 01, 2005 4:05 pm

Hello George,

Great, thanks :-)

I managed a HTML convertion :

<html>
<table border="1">
<tr>

<th>appTotal</th>

<th>appsWIssue</th>

<th>appsWUnresolvedIssue</th>

<th>appsWResolvedIssue</th>

<th>appsNoIssues</th>

</tr>
<tr>

<td>61</td>

<td>0</td>

<td>0</td>

<td>0</td>

<td>61</td>

</tr>
</table>
<table border="1">
<tr>

<th>applicationId</th>

<th>appName</th>

<th>appVersion</th>

<th>appVendorName</th>

<th>appLanguage</th>

<th>machineCount</th>

<th>issueCount</th>

<th>solutionCount</th>

</tr>
<tr>

<td>50</td>

<td>Adobe Acrobat 7.0.1 and Reader 7.0.1 Update</td>

<td>7.0</td>

<td>Adobe Systems</td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>51</td>

<td>Adobe Acrobat 7.0.2 and Reader 7.0.2 Update</td>

<td>7.0</td>

<td>Adobe Systems</td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>25</td>

<td>Adobe Reader 7.0 - Fran&ccedil;ais</td>

<td>7.0.0</td>

<td>Adobe Systems Incorporated</td>

<td>Anglais (&Eacute;tats-Unis) [0x409]</td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>80</td>

<td>Agere SoftModem Driver</td>

<td>2.1.41.10</td>

<td>Agere Systems</td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>125</td>

<td>Agere SoftModem Messaging Applet</td>

<td>2.1.41.10</td>

<td>Agere Systems</td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>27</td>

<td>Agere Systems AC'97 Modem</td>

<td></td>

<td></td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>128</td>

<td>Ahead Software Gmbh NeroCheck</td>

<td>1.0.0.2</td>

<td>Ahead Software Gmbh</td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>78</td>

<td>Andrea Audio Driver</td>

<td>4.0.1.11</td>

<td>Andrea Electronics Corporation</td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>47</td>

<td>Ashampoo UnInstaller Suite</td>

<td></td>

<td></td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>28</td>

<td>ATI Display Driver</td>

<td></td>

<td></td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>84</td>

<td>ATI External Event Utility for WindowsNT and Windows9X</td>

<td>6.14.10.4099</td>

<td>ATI Technologies Inc.</td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>29</td>

<td>BusinessObjects 5.1.8</td>

<td>5.0</td>

<td>Business Objects</td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>33</td>

<td>CandleNet ETEWatch V2.0.2 (Workstation)</td>

<td></td>

<td></td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>76</td>

<td>Enregistrement sur le Web</td>

<td></td>

<td></td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>122</td>

<td>Hewlett-Packard ProxyStop3</td>

<td>2.9.0.1</td>

<td>Hewlett-Packard</td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>121</td>

<td>Hewlett-Packard T-TR Status Client</td>

<td>0.0.0.15</td>

<td>Hewlett-Packard</td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>31</td>

<td>HP Color LaserJet 5550</td>

<td></td>

<td></td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>101</td>

<td>HP PML</td>

<td>7.0.5.0</td>

<td>HP</td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>32</td>

<td>InCD</td>

<td></td>

<td></td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>93</td>

<td>Intel Graphics Accelerator Drivers for Windows NT(R)</td>

<td>6.14.10.3741</td>

<td>Intel Corporation</td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>123</td>

<td>Intel(R) Common User Interface</td>

<td>7.0.0.2350</td>

<td>Intel Corporation</td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>49</td>

<td>Intel(R) Extreme Graphics 2 Driver</td>

<td></td>

<td></td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>94</td>

<td>McAfee Common Framework</td>

<td>3.1.1.0</td>

<td>Network Associates, Inc.</td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>24</td>

<td>McAfee VirusScan Enterprise</td>

<td>7.1.0.0</td>

<td>Network Associates, Inc.</td>

<td>Langue neutre [0x0]</td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>35</td>

<td>MSN</td>

<td></td>

<td></td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>120</td>

<td>NEC Keyboard with One-touch Start Buttons</td>

<td>5.0.0.0</td>

<td>NEC</td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>102</td>

<td>NEC MFK Driver</td>

<td>5.1.2600.0</td>

<td>NEC Corporation</td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>36</td>

<td>Nero 6</td>

<td></td>

<td></td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>124</td>

<td>Nero BackItUp Restore</td>

<td>1.2.0.52</td>

<td>Ahead Software AG</td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>37</td>

<td>Nero BurnRights</td>

<td></td>

<td></td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>38</td>

<td>Nero Digital</td>

<td></td>

<td></td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>119</td>

<td>Nero Fast CD-Burning Plug-in</td>

<td>1.2.0.1</td>

<td>Ahead Software AG</td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>39</td>

<td>Nero Media Player</td>

<td></td>

<td></td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>52</td>

<td>Nero StartSmart</td>

<td></td>

<td></td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>61</td>

<td>Nero Toolkit</td>

<td></td>

<td></td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>118</td>

<td>NeroBurnRights</td>

<td>1.0.0.12</td>

<td>Ahead Software AG</td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>87</td>

<td>o2mmb</td>

<td>0.0.0.1</td>

<td>O2 Micro</td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>63</td>

<td>OC OS Config Utility</td>

<td></td>

<td></td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>30</td>

<td>PartageUtil 01.00.00</td>

<td></td>

<td></td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>46</td>

<td>PDFCreator 0.8.0</td>

<td></td>

<td>Frank Heind&ouml;rfer, Philip Chinery</td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>127</td>

<td>Realtek Sound Manager</td>

<td>5.1.0.27</td>

<td>Realtek Semiconductor Corp.</td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>126</td>

<td>S3 Graphics, Inc. Utilities</td>

<td>1.101.2004.326</td>

<td>S3 Graphics, Inc.</td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>42</td>

<td>S3 S3Display</td>

<td></td>

<td></td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>43</td>

<td>S3 S3Gamma2</td>

<td></td>

<td></td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>44</td>

<td>S3 S3Info2</td>

<td></td>

<td></td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>45</td>

<td>S3 S3Overlay</td>

<td></td>

<td></td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>104</td>

<td>Secdrv</td>

<td></td>

<td></td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>48</td>

<td>Service D&eacute;cisionnel</td>

<td>1.0</td>

<td>LA POSTE/DSIIC/DQSC12</td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>81</td>

<td>Service for WDM 3D Audio Driver</td>

<td></td>

<td></td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>106</td>

<td>SoundMAX Digital Audio Driver</td>

<td>5.12.1.5250</td>

<td>Analog Devices, Inc.</td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>41</td>

<td>Synaptics Pointing Device Driver</td>

<td>7.12.7.0</td>

<td>Synaptics, Inc.</td>

<td>Anglais (&Eacute;tats-Unis) [0x409]</td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>40</td>

<td>UniChrome Series Driver and Utilities</td>

<td></td>

<td></td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>107</td>

<td>UniChrome(Pro) IGP Driver</td>

<td>6.14.10.132</td>

<td>Copyright (C) VIA/S3 Graphics Co, Ltd.</td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>91</td>

<td>VIA Rhine Family Fast Ethernet Adapter</td>

<td>3.18.0.403</td>

<td>VIA Technologies, Inc.</td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>34</td>

<td>VideoLAN Client 0.8.1</td>

<td></td>

<td></td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>99</td>

<td>VirusScan (Enterprise, ASaP & Retail.)</td>

<td>7.1.0.0</td>

<td>Network Associates, Inc.</td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>82</td>

<td>Windows (R) WDM driver for Realtek AC'97 Audio</td>

<td>5.10.0.5580</td>

<td>Realtek Semiconductor Corp.</td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>97</td>

<td>Windows Installer - Unicode</td>

<td>3.0.3790.2180</td>

<td>Microsoft Corporation</td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>66</td>

<td>Windows Messenger</td>

<td></td>

<td></td>

<td></td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>26</td>

<td>WINZIP</td>

<td>8.0.0</td>

<td>LA POSTE / DSIIC / DQSC12</td>

<td>1036</td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
<tr>

<td>23</td>

<td>WMAVDTX_FR</td>

<td>5.0.0</td>

<td>ICOM Informatique</td>

<td>0</td>

<td>1</td>

<td>0</td>

<td>0</td>

</tr>
</table>
<table border="1">
<tr>

<th>pageIndex</th>

<th>pageSize</th>

<th>pagesAvailable</th>

<th>rowsReturned</th>

</tr>
<tr>

<td>0</td>

<td>0</td>

<td>1</td>

<td>61</td>

</tr>
</table>
</html>

Tell me what you think, when time permits.

Did that with oXygen, but would prefer a command line version so that I can prepare a batch...

Cheers
Jimmy

george
Site Admin
Posts: 2101
Joined: Thu Jan 09, 2003 2:58 pm

Post by george » Mon Aug 01, 2005 4:18 pm

Hi,
Did that with oXygen, but would prefer a command line version so that I can prepare a batch...
See
http://www.oxygenxml.com/pipermail/oxyg ... 00534.html

Best Regards,
George

gourou76
Posts: 4
Joined: Sun Jul 31, 2005 12:32 am

Post by gourou76 » Wed Aug 03, 2005 11:07 pm

Hi George,

Thanks to you who invested time to help me out. What I have done is a cocktail. Using an XSL stylesheet and xslt2.exe, I have now a well formed HTML file.

Next thing, I am now installing Ubuntu 5.10 in order to try FO.

Best wishes and keep up the good jib,
Jimmy

Post Reply