Hi Forum members,
I am encountering an issue in Saxon 9.1 XSLT 2.0 stylesheet when trying to
open secondary xhtml documents (using document() function) generated from
TagSoup parser which included the following DTD entity reference:
The data that I need is in the xhtml document already and the lookup of DTD
has been more of a nuisance in this case. As a result, I am wondering whether
the following steps could be achieved:
( i ) How to direct the document() function in masterdox1.xsl stylesheet to
use catalog.xml to lookup local a copy of DTD instead.
Please refer to the original issue
list/archives/201007/msg00094.html which has been partly
resolved using catalog.xml when looking up the main source in Java as follows:
// Convert State HTML to XML format
SAXBuilder stateSaxBuilder = new SAXBuilder("org.ccil.cowan.tagsoup.Parser",
org.jdom.Document xhtmlmainjdomDocument = saxBuilder.build(originalHTMLFILE);
Transformer transformer = TransformerFactory.newTransformer(new
JDOMSource source = new JDOMSource(xhtmlmainjdomDocument);
JDOMResult result = new JDOMResult();
transformer.transform(source, result); // breaks on line 17 below in
masterdox1.xsl when trying to read additional xhtml docs
The snippet of masterdox1.xsl is as follows:
8 <xsl:template match="/">
Any assistance would be much appreciated.
The basic answer is here:
except that it's written in terms of using the command line rather than the
JAXP API. It describes it like this:
Similarly, Saxon supports command-line access to the resolvers:
The -x class is used to read source documents, the -y class is used to read
The one that's important in your case (resolving the reference to a DTD held
in the source document) is the -x option, which selects an XML parser
preconfigured to use an EntityResolver that uses the catalog. The equivalent
option using the JAXP API is
Yes, perfect! Everything is working at last.
Word cannot explain how elated I feel finally after beating around the bush
for so long.
This couldn't have been achieved without your help.
Thank you very much once again,