Hi all I'm new to xml/xsl so please bear with me if I'm being stupid. For my application I'm using xml schema to describe the xml files and xslt to transform them into different output variants - pretty standard. In my schema I set default/fixed values for some attributes that I then use during the xslt. My problem is the xsltproc/libxslt is not able to find these default/fixed values in the schema. Well, I have googled a little and found the following: 1) In the w3c xpath spec (http://www.w3.org/TR/xpath#attribute-nodes) it says that "The XML Recommendation does not require an XML processor to read an external DTD or an external parameter unless it is validating". 2) According to a mail in the archive this works for xml files described by a DTD (test case 53) My question is: Is this supposed to work for transformation of xml files described by an xml schema?? I also tried to write a python script that both validates the xml file and applies the style sheet - same result. Any ideas/help?? Best regards, Steffen
Attachment:
test_document.xml
Description: application/xml
Attachment:
test_schema.xsd
Description: application/xml
Attachment:
test_stylesheet.xsl
Description: application/xslt
#! /usr/bin/python import libxml2 import libxslt styledoc = libxml2.parseFile("test_stylesheet.xsl") style = libxslt.parseStylesheetDoc(styledoc) ctxt_parser = libxml2.schemaNewParserCtxt("test_schema.xsd") ctxt_schema = ctxt_parser.schemaParse() ctxt_valid = ctxt_schema.schemaNewValidCtxt() doc = libxml2.parseFile("test_document.xml") ret = doc.schemaValidateDoc(ctxt_valid) if ret != 0: print "error doing schema validation" else: result = style.applyStylesheet(doc, None) output = style.saveResultToString(result) print output style.freeStylesheet() doc.freeDoc() result.freeDoc()