简体   繁体   中英

How to convert XML to XSL-FO

I have created an XML file to convert that into a XSL-Formatting Objects. My XML file contains " list " as an root element and " com.ecom " as a repeated element to get populated many number of times.

My XML file look like below format:

<?xml version="1.0" encoding="UTF-8"?>
<list>
<com.ecom>
    <name>test123</name>
    <countryCode>IND</countryCode>
    <logo>test.jpg</logo>
    <personal>
        <com.ecom.personal>
            <details>abcd</details> 
            <hours>12:00IST</hours>
        </com.ecom.personal>
    </personal>
</com.ecom>
<com.ecom>
    <name>test123</name>
    <countryCode>IND</countryCode>
    <logo>test.jpg</logo>
    <personal>
        <com.ecom.personal>
            <details>abcd</details> 
            <hours>1:00PM</hours>
        </com.ecom.personal>
    </personal>
</com.ecom>
<com.ecom>
    <name>test123</name>
    <countryCode>IND</countryCode>
    <logo>test.jpg</logo>
    <personal>
        <com.ecom.personal>
            <details>abcd</details> 
            <hours>10:00AM</hours>
            <url>
                <url-name>http://www.sample.com</url-name>
            </url>
        </com.ecom.personal>
    </personal>
</com.ecom>
<com.ecom>
    <name>test123</name>
    <countryCode>IND</countryCode>
    <logo>test.jpg</logo>
    <personal>
        <com.ecom.personal>
            <details>abcd</details> 
            <hours>2:00PM</hours>
        </com.ecom.personal>
    </personal>
</com.ecom>
</list>

I wanted to convert this XML file into an XSL-FO format. Please help me out...

The most common way would be to use XSLT to transform your XML into the XSL-FO vocabulary. Searching StackExchange for questions with the 'xsl-fo' tag will find you multiple examples (some better than others) of some XML plus the XSLT stylesheet for transforming that XML into XSL-FO. You could mine those for solutions to parts of your problem and/or you could look at some of the references available on the web.

Tutorials and examples:

XSL-FO quick references

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM