Alain wrote:
As you've started to realize, implementing XInclude completely in XSLT
is non-trivial, although it is possible (I've done it in XSLT 1.1, at
least for a subset of XPath).
The main reason *to* do it is to fix the design flaw in Xinclude, namely
that IDs in the input are (at least as I read the spec) supposed to be
blindly copied to the result (meaning your IDs have to be unique across
all the documents being included, which is an insane requirement). By
doing it in XSLT you can rewrite the IDs and the references to them,
allowing you to use XInclude with any set of documents.
But this still requires doctype-specific processing (because you have to
know what elements have IDs and which have references to those IDs and
what the details of the addressing syntax is).
Or maybe you would have a sounder advise such as: "why not install
Xerces on your Ubuntu and make it work with Saxon?" (answer is, I'm
being lazy finding and reading the documentation for that difficult task
;-) )
Here is a sample class that I use with SaxonB V9 to get to both Xerces
schema-aware parsing and catalog resolution. Just specify it as the
class name on the -x parameter to Saxon:
--- start of SchemaValidatingCatalogResolvingXMLReader.java ---
package org.fasb.xerces;
import org.apache.xml.resolver.CatalogManager;
import org.apache.xml.resolver.tools.ResolvingXMLReader;
import org.xml.sax.SAXNotRecognizedException;
/**
*
*/
public class SchemaValidatingCatalogResolvingXMLReader extends
ResolvingXMLReader {
/**
* @throws Throwable
* @throws SAXNotRecognizedException
*
*/
public SchemaValidatingCatalogResolvingXMLReader() throws
SAXNotRecognizedException, Throwable {
super();
init();
}
/**
* @throws Throwable
* @throws SAXNotRecognizedException
*
*/
private void init() throws SAXNotRecognizedException, Throwable {
// System.err.println(" + INFO: Using " +
this.getClass().getName());
this.setFeature("http://xml.org/sax/features/validation",
false);
this.setFeature("http://apache.org/xml/features/validation/schema", true);
this.setFeature("http://apache.org/xml/features/validation/dynamic",
true);
}
/**
* @param catalogManager
* @throws Throwable
* @throws SAXNotRecognizedException
*/
public SchemaValidatingCatalogResolvingXMLReader(CatalogManager
catalogManager) throws SAXNotRecognizedException, Throwable {
super(catalogManager);
init();
}
}
-- End of Java class ---
--
Eliot Kimber
Senior Solutions Architect
"Bringing Strategy, Content, and Technology Together"
Main: 610.631.6770
www.reallysi.com
www.rsuitecms.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>
--~--