[xml] Embedded styleheets



Hi,

I use xsltLoadStylesheetPI() to extract an embedded stylesheet from an
already loaded xml document. The code looks similar to xsltproc.c, and
I get the same error, as I get when processing the xml document using
xsltproc:

D:\Pi3Web\WebRoot>..\bin\xsltproc books.xml
error: file books.xml element xml-stylesheet
xml-stylesheet : no ID style0815 found
compilation error: file books.xml line 16 element books
xsltParseStylesheetProcess : document is not a stylesheet

And this error has been produced by my code:
[Sat Apr 13 15:14:54 2002 GMT] error: file D:\Pi3Web\WebRoot\books.xml element xml-stylesheet
[Sat Apr 13 15:14:54 2002 GMT] xml-stylesheet : no ID style0815 found
[Sat Apr 13 15:14:54 2002 GMT] XSLT: Can't load stylesheet for file with path 'D:\Pi3Web\WebRoot\books.xml'.
[Sat Apr 13 15:14:54 2002 GMT] XSLT: Using libxml 20419 and libxslt 10015.

I use global parser settings
        xmlLineNumbersDefault(1);
        xmlSubstituteEntitiesDefault(1);
        xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;

I looked into the code and found, the ID table (doc->ids) of the document is empty.
OK, I added a hackish DTD to the XML file:

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

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

]>

But only if I switch on the following, in order to validate the document

//      xmlDoValidityCheckingDefaultValue = 1;

the embedded stylesheet is found, unconsidered the validity of the document.
And now the transformation is performed. What am I doing wrong? I am
using the libxml2 and libxslt versions as shown in the above error message.
-- 
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
----------------------------------------------------------



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