xsl-list
[Top] [All Lists]

Re: [xsl] question on support of stylesheet embedding

2009-07-20 14:15:55
On 15/07/2009, Hermann Stamm-Wilbrandt <STAMMW(_at_)de(_dot_)ibm(_dot_)com> 
wrote:
My interest in this was to eliminate the need for file "cdcatalog.xsl.xsl"
by incorporating "something" as embedded stylesheet into "cdcatalog1.xml"
and "cdcatalog2.xml" from posting "../200906/msg00070.html"
(see http://www.stamm-wilbrandt.de/en/xsl-list/xsl-url/#listings).

Since stylesheet embedding is not supported by all browsers I will not
investigate further into that direction.
If you reverse the method and include your data in the xsl:stylesheet
(example below) it will work with all browsers. Remarks:
- tested with IE 6, Firefox 3.5, Opera 9.6.
- the PI would work also with an empty href (exept IE)
- the file embedd-test3.xsl was served with application/xml

Regards,

Manfred Staudinger

embedd-test3.xsl:
<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="embedd-test3.xsl"?>
<xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
        <xsl:output method="html"/>
        <xsl:template match="/">.
                <xsl:apply-templates 
select="*/xsl:variable[(_at_)name='catalog']/*"/>
        </xsl:template>
        <xsl:template match="catalog">
                <html>
                        <body>
                                <h2>My CD Collection</h2>
                                <table border="1">
                                        <tr bgcolor="#9acd32">
                                                <th>Title</th>
                                                <th>Artist</th>
                                        </tr>
                                        <xsl:apply-templates select="*"/>
                                </table>
                        </body>
                </html>
        </xsl:template>
        <xsl:template match="cd">
                <tr>
                        <td><xsl:value-of select="title"/></td>
                        <td><xsl:value-of select="artist"/></td>
                </tr>
        </xsl:template>
        <xsl:variable name="catalog">
                <catalog>
                        <cd>
                                <title>Empire Burlesque</title>
                                <artist>Bob Dylan</artist>
                                <country>USA</country>
                                <company>Columbia</company>
                                <price>10.90</price>
                                <year>1985</year>
                        </cd>
                        <cd>
                                <title>The white album</title>
                                <artist>Beatles</artist>
                                <country>UK</country>
                                <company>apple</company>
                                <price>???</price>
                                <year>196?</year>
                        </cd>
                </catalog>
        </xsl:variable>
</xsl:stylesheet>



On 15/07/2009, Hermann Stamm-Wilbrandt <STAMMW(_at_)de(_dot_)ibm(_dot_)com> 
wrote:
I tried this in Chrome, and it does a fantastic job ! Which is amazing
to me because chrome does horribly on "pure xml" files ... one thing I
keep IE lying around

It is fine that most browsers but IEs support stylesheet embedding.

My interest in this was to eliminate the need for file "cdcatalog.xsl.xsl"
by incorporating "something" as embedded stylesheet into "cdcatalog1.xml"
and "cdcatalog2.xml" from posting "../200906/msg00070.html"
(see http://www.stamm-wilbrandt.de/en/xsl-list/xsl-url/#listings).

Since stylesheet embedding is not supported by all browsers I will not
investigate further into that direction.


Mit besten Grüßen / Best wishes,

Hermann Stamm-Wilbrandt
Developer, XML Compiler
WebSphere DataPower SOA Appliances
----------------------------------------------------------------------
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Erich Baier
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294



             "David A. Lee"
             <dlee(_at_)calldei(_dot_)com
             >                                                          To
                                       
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
             07/15/2009 06:24                                           cc
             PM
                                                                   Subject
                                       Re: [xsl] question on support of
             Please respond to         stylesheet embedding
             xsl-list(_at_)lists(_dot_)mu
              lberrytech.com








I tried this in Chrome, and it does a fantastic job ! Which is amazing
to me because chrome does horribly on "pure xml" files ... one thing I
keep IE lying around

David A. Lee
dlee(_at_)calldei(_dot_)com
http://www.calldei.com,
http://www.xmlsh.org
812-482-5224



Martin Honnen wrote:
Hermann Stamm-Wilbrandt wrote:

the spec says that embedding a stylesheet into a XML document is
possible:
http://www.w3.org/TR/xslt#section-Embedding-Stylesheets

After some searching I was able to get the cdcatalog sample below
working:
(http://www.stamm-wilbrandt.de/en/xsl-list/cdcatalog.xml if you want to
click).

But it is working for Firefox 2/3 and Opera 9.64, NOT for MS IE6.
I found neither negative nor positive statements on IE 6/7/8 support
of stylesheet embedding while searching the web.

Does anybody now the answer whether any of the Microsoft browsers
supports
stylesheet embedding?

It does not look like that is supported with IE. IE 8 when I try your
test case http://www.stamm-wilbrandt.de/en/xsl-list/cdcatalog.xml
seems to sniff the content and try to interpret it as text/html
meaning you end up with a browser window displaying the contents of
the first title element in the window bar and a table with only the
header row as the contents of the document followed by any text nodes
in all those unknown (to the HTML parser) elements like artist, country.



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--