Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

xslt generator

Posted on 2009-05-14
11
Medium Priority
?
545 Views
Last Modified: 2013-11-18
Is there any xslt generator help to generate an xslt from an xml raw data file + html output?
0
Comment
Question by:kennysflau
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 3
11 Comments
 

Author Comment

by:kennysflau
ID: 24383206
<html>
   <body>
      <table width="640" border="2">
         
            <tr><td>companyKeyOrderNo</td><td>00001</td></tr>
            <tr><td>orderType</td><td>OH</td></tr>
            <tr><td>documentOrderInvoiceE</td><td>6255</td></tr>
            <tr><td>lineNumber</td><td>2.000</td></tr>
            <tr><td>statusCodeLast</td><td>225</td></tr>
            <tr><td>costCenter</td><td>19999</td></tr>
            <tr><td>addressNumber</td><td>32773</td></tr>
            <tr><td>itemNumberRelatedKit</td><td></td></tr>
            <tr><td>descriptionLine1</td><td>Stationery </td></tr>
            <tr><td>orderSuffix</td><td>000</td></tr>
                  <tr><td>identifier2ndItem</td><td>392-00</td></tr>
         
            <tr><td>companyKeyOrderNo</td><td>00001</td></tr>
            <tr><td>orderType</td><td>OH</td></tr>
            <tr><td>documentOrderInvoiceE</td><td>6255</td></tr>
            <tr><td>lineNumber</td><td>1.000</td></tr>
            <tr><td>statusCodeLast</td><td>420</td></tr>
            <tr><td>costCenter</td><td>19999</td></tr>
            <tr><td>addressNumber</td><td>32773</td></tr>
            <tr><td>itemNumberRelatedKit</td><td></td></tr>
            <tr><td>descriptionLine1</td><td>Stationery </td></tr>
            <tr><td>orderSuffix</td><td>000</td></tr>
                  <tr><td>identifier2ndItem</td><td>392-00</td></tr>
             
         <tr><td>companyKeyOrderNo</td><td>00001</td></tr>
         <tr><td>orderType</td><td>OH</td></tr>
         <tr><td>documentOrderInvoiceE</td><td>6244</td></tr>
         <tr><td>lineNumber</td><td>1.000</td></tr>
         <tr><td>statusCodeLast</td><td>280</td></tr>
         <tr><td>costCenter</td><td>19999</td></tr>
         <tr><td>addressNumber</td><td>32324</td></tr>
         <tr><td>itemNumberRelatedKit</td><td></td></tr>
         <tr><td>descriptionLine1</td><td>Printing </td></tr>
         <tr><td>orderSuffix</td><td>000</td></tr>
             <tr><td>identifier2ndItem</td><td>390-00</td></tr>
         
      </table>
   </body>
</html>
0
 

Author Comment

by:kennysflau
ID: 24383208
<env:Envelope
  xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:ns0="http://oracle.e1.bssv.JPF43111/types/">
 <env:Body>
  <ans1:getF4311ResponseElement
    xmlns:ans1="http://oracle.e1.bssv.JPF43111/"
    xsi:type="ns0:F4311_List">
   <ns0:e1MessageList/>
   <ns0:result
     xsi:type="ns0:F4311_Output">
    <ns0:companyKeyOrderNo>00001</ns0:companyKeyOrderNo>
    <ns0:orderType>OH</ns0:orderType>
    <ns0:documentOrderInvoiceE>6255</ns0:documentOrderInvoiceE>
    <ns0:lineNumber>2.000</ns0:lineNumber>
    <ns0:statusCodeLast>225</ns0:statusCodeLast>
    <ns0:costCenter> 19999</ns0:costCenter>
    <ns0:addressNumber>32773</ns0:addressNumber>
    <ns0:itemNumberRelatedKit/>
    <ns0:descriptionLine1>Stationery </ns0:descriptionLine1>
    <ns0:orderSuffix>000</ns0:orderSuffix>
    <ns0:identifier2ndItem>392-00 </ns0:identifier2ndItem>
   </ns0:result>
   <ns0:result
     xsi:type="ns0:F4311_Output">
    <ns0:companyKeyOrderNo>00001</ns0:companyKeyOrderNo>
    <ns0:orderType>OH</ns0:orderType>
    <ns0:documentOrderInvoiceE>6255</ns0:documentOrderInvoiceE>
    <ns0:lineNumber>1.000</ns0:lineNumber>
    <ns0:statusCodeLast>420</ns0:statusCodeLast>
    <ns0:costCenter> 19999</ns0:costCenter>
    <ns0:addressNumber>32773</ns0:addressNumber>
    <ns0:itemNumberRelatedKit/>
    <ns0:descriptionLine1>Stationery </ns0:descriptionLine1>
    <ns0:orderSuffix>000</ns0:orderSuffix>
    <ns0:identifier2ndItem>392-00 </ns0:identifier2ndItem>
   </ns0:result>
   <ns0:result
     xsi:type="ns0:F4311_Output">
    <ns0:companyKeyOrderNo>00001</ns0:companyKeyOrderNo>
    <ns0:orderType>OH</ns0:orderType>
    <ns0:documentOrderInvoiceE>6244</ns0:documentOrderInvoiceE>
    <ns0:lineNumber>1.000</ns0:lineNumber>
    <ns0:statusCodeLast>280</ns0:statusCodeLast>
    <ns0:costCenter> 19999</ns0:costCenter>
    <ns0:addressNumber>32324</ns0:addressNumber>
    <ns0:itemNumberRelatedKit/>
    <ns0:descriptionLine1>Printing </ns0:descriptionLine1>
    <ns0:orderSuffix>000</ns0:orderSuffix>
    <ns0:identifier2ndItem>390-00 </ns0:identifier2ndItem>
   </ns0:result>
  </ans1:getF4311ResponseElement>
 </env:Body>
</env:Envelope>
0
 
LVL 39

Expert Comment

by:abel
ID: 24383351
How would that XSLT generator look like? XSLT is a programming language and you can do (almost) anything with it in regards to transforming one format into the other. The output can be XML, HTML, Text, and with XSLT 2.0 even other formats can be supported (actually, in XSLT 1.0 as well, but that requires extensions).

It seems that your XSLT contains nodes under ns0:result which should be translated into <td>keyname</td><td>keyvalue</td>. This only requires a few lines of XSLT to do. Hold on a minute., I'll dig up an example.

- Abel --
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 39

Expert Comment

by:abel
ID: 24383357
PS: in the future, please use "Attach code snippet", it is there for a reason: makes the thread more readable and the code easier to cut and paste.
0
 
LVL 39

Expert Comment

by:abel
ID: 24383411
My 10 minutes. This little XSLT will provide the output you specified:


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
    xmlns:types="http://oracle.e1.bssv.JPF43111/types/"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
 
    <xsl:output method="html" indent="yes" />
    
    <xsl:template match="/">
        <html>
            <body>
                <table width="640" border="2">
                    <xsl:apply-templates select="*" />
                </table>
            </body>
        </html>
    </xsl:template>
    
    <xsl:template match="types:result/*">
        <tr>
            <td><xsl:value-of select="local-name(.)"/></td>
            <td><xsl:value-of select="."/></td>
        </tr>
    </xsl:template>
    
    <!-- do not output anything for nodes we do not specify -->
    <xsl:template match="* | node()" >
        <xsl:apply-templates select="*" />
    </xsl:template>
    
</xsl:stylesheet>

Open in new window

0
 
LVL 39

Expert Comment

by:abel
ID: 24383418
More to the point, because I used indent="yes", this is the output when I run it against your data:

<html xmlns:types="http://oracle.e1.bssv.JPF43111/types/">
   <body>
      <table width="640" border="2">
         <tr>
            <td>companyKeyOrderNo</td>
            <td>00001</td>
         </tr>
         <tr>
            <td>orderType</td>
            <td>OH</td>
         </tr>
         <tr>
            <td>documentOrderInvoiceE</td>
            <td>6255</td>
         </tr>
         <tr>
            <td>lineNumber</td>
            <td>2.000</td>
         </tr>
         <tr>
            <td>statusCodeLast</td>
            <td>225</td>
         </tr>
         <tr>
            <td>costCenter</td>
            <td> 19999</td>
         </tr>
         <tr>
            <td>addressNumber</td>
            <td>32773</td>
         </tr>
         <tr>
            <td>itemNumberRelatedKit</td>
            <td></td>
         </tr>
         <tr>
            <td>descriptionLine1</td>
            <td>Stationery </td>
         </tr>
         <tr>
            <td>orderSuffix</td>
            <td>000</td>
         </tr>
         <tr>
            <td>identifier2ndItem</td>
            <td>392-00 </td>
         </tr>
         <tr>
            <td>companyKeyOrderNo</td>
            <td>00001</td>
         </tr>
         <tr>
            <td>orderType</td>
            <td>OH</td>
         </tr>
         <tr>
            <td>documentOrderInvoiceE</td>
            <td>6255</td>
         </tr>
         <tr>
            <td>lineNumber</td>
            <td>1.000</td>
         </tr>
         <tr>
            <td>statusCodeLast</td>
            <td>420</td>
         </tr>
         <tr>
            <td>costCenter</td>
            <td> 19999</td>
         </tr>
         <tr>
            <td>addressNumber</td>
            <td>32773</td>
         </tr>
         <tr>
            <td>itemNumberRelatedKit</td>
            <td></td>
         </tr>
         <tr>
            <td>descriptionLine1</td>
            <td>Stationery </td>
         </tr>
         <tr>
            <td>orderSuffix</td>
            <td>000</td>
         </tr>
         <tr>
            <td>identifier2ndItem</td>
            <td>392-00 </td>
         </tr>
         <tr>
            <td>companyKeyOrderNo</td>
            <td>00001</td>
         </tr>
         <tr>
            <td>orderType</td>
            <td>OH</td>
         </tr>
         <tr>
            <td>documentOrderInvoiceE</td>
            <td>6244</td>
         </tr>
         <tr>
            <td>lineNumber</td>
            <td>1.000</td>
         </tr>
         <tr>
            <td>statusCodeLast</td>
            <td>280</td>
         </tr>
         <tr>
            <td>costCenter</td>
            <td> 19999</td>
         </tr>
         <tr>
            <td>addressNumber</td>
            <td>32324</td>
         </tr>
         <tr>
            <td>itemNumberRelatedKit</td>
            <td></td>
         </tr>
         <tr>
            <td>descriptionLine1</td>
            <td>Printing </td>
         </tr>
         <tr>
            <td>orderSuffix</td>
            <td>000</td>
         </tr>
         <tr>
            <td>identifier2ndItem</td>
            <td>390-00 </td>
         </tr>
      </table>
   </body>
</html>

Open in new window

0
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 1000 total points
ID: 24386649
I think you are referring to something like this
http://www.stylusstudio.com/xslt_designer.html
But tools like that have limitations,
anyway, it can get you started,
you can download it to have a test
0
 

Author Comment

by:kennysflau
ID: 24391405
Thanks Gertone, yes this is what I need.

Do you know if I can something like this but free of charge?
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 24392544
No, as far as I know there are two products of this kind.
The second delivers obscure XSLT and is more expensive, so I don't mention it
(and by the way I hate Altova tools :)
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 24392545
Money on Stylus Studio is by the way very well spent
0
 
LVL 39

Expert Comment

by:abel
ID: 24393386
So much for giving a full, simple solution that gives you the requested output... :(

Anyway, glad that you found what you want. I know I didn't answer your original request, mainly because these tools seldomly create helpful XSLT files, let alone performant or elegant and that I just wanted to show you how easy it can be to do it by hand (and in my case, I use oXygen or Stylus Studio). I second the opinion of Gertone on Mapforce, I tried it years ago and won't do that again any time soon.


0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question