Re: [xml] Embedded styleheets



Hi Daniel,

thanks for the fast reply and for the libxml and related work. I want
to use it for real-time XSLT processing in a web server and it works
really fast. It took me only one night to integrate libxslt into the
server, speaks for a comprehensive and self-explaining API.

  Seems you're using #style0815 to point to a subpart of the document.
^^
Correct.

Since it is an XML resource it means "point to element of ID 'style0815'"
and libxml2 will only try to handle DTDs and associated constructs
if asked for.
  Setting xmlLoadExtDtdDefaultValue = XML_DETECT_IDS might be sufficient
and less expensive that real full validation.
^^
Yes, I already use this setting, but without the required effect. I would
also prefer wellformed xml without validation to save the computing effort
(XSLT at web server). But it seems it doesn't work with embedded stylesheets
as expected. On the other hand the embedded stylesheet syntax has some
advantages for server use: Only one file to handle, no other overhead.

Since it is the same error when using xsltproc, maybe the xml file I want to
process is broken?


Daniel

P.S.: using file name like D:\Pi3Web\WebRoot\books.xml is very risky as
      soon as you try build URI-Reference from it, it is not an URI syntax.
^^
True, the code is still experimental, need to work on this and much other
details.
-- 
regards
Holger

TMTOWTDI - There's More Than One Way To Do It - Perl motto
----------------------------------------------------------
Holger 'zimpel' Zimmermann 
----------------------------------------------------------
Wendishain                    
Germany                       
----------------------------------------------------------
http://home.t-online.de/home/zimpel/
http://pi3web.sourceforge.net/

mailto:zimpel t-online de
----------------------------------------------------------
<?xml version="1.0"?>

<!DOCTYPE books [
<!ELEMENT books (book*,xsl:stylesheet)>
<!ELEMENT book ANY>
<!ELEMENT xsl:stylesheet ANY>

<!ATTLIST xsl:stylesheet
  id ID #REQUIRED
  version NMTOKEN #REQUIRED
  xmlns:xsl CDATA #FIXED "http://www.w3.org/1999/XSL/Transform";

]>

<?xml-stylesheet type="text/xsl" href="#style0815"?>
<books>
        <book category="reference">
                <author>Nigel Rees</author>
                <title>Sayings of the Century</title>
                <price>8.95</price>
        </book>
        <book category="fiction">
                <author>Evelyn Waugh</author>
                <title>Sword of Honour</title>
                <price>12.99</price>
        </book>
        <book category="fiction">
                <author>Herman Melville</author>
                <title>Moby Dick</title>
                <price>8.99</price>
        </book>
        <book category="fiction">
                <author>J. R. R. Tolkien</author>
                <title>The Lord of the Rings</title>
                <price>22.99</price>
        </book>

        <xsl:stylesheet id="style0815" version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

                <xsl:output method="html"/>
                <xsl:param name="caption" select="'A list of books'"/>

                <xsl:template match="books">
                        <html><body>
                        <h1><xsl:value-of select="$caption"/></h1>
                        <table width="640">
                        <xsl:apply-templates/>
                        </table>
                        </body></html>
                </xsl:template>

                <xsl:template match="book">
                        <tr>
                        <td><xsl:number/></td>
                        <xsl:apply-templates/>
                        </tr>
                </xsl:template>

                <xsl:template match="author | title | price">
                        <td><xsl:value-of select="."/></td>
                </xsl:template>

        </xsl:stylesheet>

</books>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]