Subject: XSLT to make multiple hyperlinked HTML files
Posted By: dai.hop Post Date: 1/11/2006 1:22:27 PM
Hello everyone,

I'm trying to create an XSL stylesheet that takes the contents of products.xml:



<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="site 1/products.xsl"?>
<catalog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="products.xsd">
    <tv>
        <lcd>
            <product>
                <model>Haier</model>
                <inches>30</inches>
                <description>The best</description>
                <price>550</price>
                <image>good looking</image>
            </product>
        </lcd>
        <plasma>
            <product>
                <model>sony</model>
                <inches>20</inches>
                <description>wega</description>
                <price>20000</price>
                <image>ikt ok</image>
            </product>
        </plasma>
    </tv>
    <pc>
        <desktop>
            <product>
                <model>Dell</model>
                <memory>1024 MB</memory>
                <cpu>AMD 3000+</cpu>
                <disksize>180 GB</disksize>
                <description>quite quick</description>
                <price>800</price>
            </product>
        </desktop>
        <laptop>
            <product>
                <model>Acer</model>
                <memory>512 MB</memory>
                <cpu>Centrino</cpu>
                <disksize>40 GB</disksize>
                <description>small lightweiht</description>
                <price>499</price>
            </product>
        </laptop>
    </pc>
</catalog>



and produces multiple HTML files from it, for example a start page with TV and PC hyperlinks that link to their relevent sub-sections.

Can anyone help me out with this? I'm struggling!

Many Thanks,

dai.hop

Reply By: mhkay Reply Date: 1/11/2006 2:05:32 PM
XSLT 2.0 has a standard way of producing multiple output files, xsl:result-document. Some XSLT 1.0 processors have a vendor extension to achieve the same thing.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference

Go to topic 38602

Return to index page 398
Return to index page 397
Return to index page 396
Return to index page 395
Return to index page 394
Return to index page 393
Return to index page 392
Return to index page 391
Return to index page 390
Return to index page 389