You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by ck...@onebox.com on 2005/08/01 17:27:15 UTC

RE: Help to convert an XML document to another format

I think you will have better luck if you post this kind of question to the XSL list at http://www.mulberrytech.com/xsl/xsl-list/index.html, but that notwithstanding, I looked over your file to see if I could help.

I had some problem with the encoding, so in order to proceed I removed the characters with accent marks. English doesn't use them and you didn't give any hint as to the encoding you are using. Is is the usual MS Windows ISO encoding?

Having changed the accented characters to non-accented characters I then wrote a stylesheet to transform your file to an HTML page. I added some minimal styling to make it more readable.

You didn't offer any explanation for "The issue is that I need to be able to exploit it.", so I don't know if you can exploit an HTML page. Here is the stylesheet.:

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:output method="xml" indent="yes" encoding="UTF-8" />

 <xsl:template match="/">
  <xsl:apply-templates />
 </xsl:template>

 <xsl:template match="NewDataSet">
  <html>
   <head>
    <style type="text/css">
     .td-header  {font-family:Arial;font-weight:bold;}
     .td-data   {font-family:Arial;font-weight:normal;font-size:6 pt.;}
    </style>
   </head>
   <body>
    <table>
     <tr><xsl:apply-templates select="Table" mode="header-row" /></tr>
     <xsl:apply-templates select="Table" mode="body-row" />
    </table>
    <table>
     <tr><xsl:apply-templates select="Table1[1]" mode="header-row" /></tr>
     <xsl:apply-templates select="child::Table1" mode="body-row" />
    </table>
    <table>
     <tr><xsl:apply-templates select="Table2" mode="header-row" /></tr>
     <xsl:apply-templates select="Table2" mode="body-row" />
    </table>
   </body>
  </html>
 </xsl:template>

 <xsl:template match="Table|Table1|Table2" mode="header-row">
  <xsl:call-template name="col-names" />
 </xsl:template>

 <xsl:template match="Table|Table1|Table2" mode="body-row">
  <tr><xsl:call-template name="values" /></tr>
 </xsl:template>

 <xsl:template name="col-names">
  <xsl:for-each select="child::*">
   <td class="td-header"><xsl:value-of select="name()" /></td>
  </xsl:for-each>
 </xsl:template>

 <xsl:template name="values">
  <xsl:for-each select="child::*">
   <td class="td-data"><xsl:value-of select="." /></td>
  </xsl:for-each>
 </xsl:template>

</xsl:stylesheet>
-- 
Charles Knell
cknell@onebox.com - email



-----Original Message-----
From:     Jimmy Pierre <jp...@cisware.com>
Sent:     Sun, 31 Jul 2005 23:07:47 +0200
To:       <fo...@xmlgraphics.apache.org>
Subject:  Help to convert an XML document to another format

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> 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




RE: Help to convert an XML document to another format

Posted by Jimmy Pierre <jp...@cisware.com>.
Hi Charles,

Thanks for your input!

Incidentally Microsoft has a product (free) for validating applications for
running on XP SP2, namely Application Compatibility Toolkit version 4.

This application displays a beautiful XML and offers only XML export. I 
am just
stuck to watch the file :-)

When I meant by to exploit, was, I can print it, give it to my client 
or simply
copy / paste in a  WordProcesssor. Ideally, if it ever existed a multi output
tool that can just transform an XML on the fly and using a batch.... I have
Linux and Windows boxes.

Cheers,
Jimmy

Quoting cknell@onebox.com:

> I think you will have better luck if you post this kind of question 
> to the XSL list at 
> http://www.mulberrytech.com/xsl/xsl-list/index.html, but that 
> notwithstanding, I looked over your file to see if I could help.
>
> I had some problem with the encoding, so in order to proceed I 
> removed the characters with accent marks. English doesn't use them 
> and you didn't give any hint as to the encoding you are using. Is is 
> the usual MS Windows ISO encoding?
>
> Having changed the accented characters to non-accented characters I 
> then wrote a stylesheet to transform your file to an HTML page. I 
> added some minimal styling to make it more readable.
>
> You didn't offer any explanation for "The issue is that I need to be 
> able to exploit it.", so I don't know if you can exploit an HTML 
> page. Here is the stylesheet.:
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <xsl:stylesheet version="1.0" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>  <xsl:output method="xml" indent="yes" encoding="UTF-8" />
>
>  <xsl:template match="/">
>   <xsl:apply-templates />
>  </xsl:template>
>
>  <xsl:template match="NewDataSet">
>   <html>
>    <head>
>     <style type="text/css">
>      .td-header  {font-family:Arial;font-weight:bold;}
>      .td-data   {font-family:Arial;font-weight:normal;font-size:6 pt.;}
>     </style>
>    </head>
>    <body>
>     <table>
>      <tr><xsl:apply-templates select="Table" mode="header-row" /></tr>
>      <xsl:apply-templates select="Table" mode="body-row" />
>     </table>
>     <table>
>      <tr><xsl:apply-templates select="Table1[1]" mode="header-row" /></tr>
>      <xsl:apply-templates select="child::Table1" mode="body-row" />
>     </table>
>     <table>
>      <tr><xsl:apply-templates select="Table2" mode="header-row" /></tr>
>      <xsl:apply-templates select="Table2" mode="body-row" />
>     </table>
>    </body>
>   </html>
>  </xsl:template>
>
>  <xsl:template match="Table|Table1|Table2" mode="header-row">
>   <xsl:call-template name="col-names" />
>  </xsl:template>
>
>  <xsl:template match="Table|Table1|Table2" mode="body-row">
>   <tr><xsl:call-template name="values" /></tr>
>  </xsl:template>
>
>  <xsl:template name="col-names">
>   <xsl:for-each select="child::*">
>    <td class="td-header"><xsl:value-of select="name()" /></td>
>   </xsl:for-each>
>  </xsl:template>
>
>  <xsl:template name="values">
>   <xsl:for-each select="child::*">
>    <td class="td-data"><xsl:value-of select="." /></td>
>   </xsl:for-each>
>  </xsl:template>
>
> </xsl:stylesheet>
> --
> Charles Knell
> cknell@onebox.com - email
>
>
>
> -----Original Message-----
> From:     Jimmy Pierre <jp...@cisware.com>
> Sent:     Sun, 31 Jul 2005 23:07:47 +0200
> To:       <fo...@xmlgraphics.apache.org>
> Subject:  Help to convert an XML document to another format
>
> 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> 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
>
>
>
>




---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org