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:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


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 stylesheet to use catalog.xml to lookup local a copy of DTD instead.


Please refer to the original issue http://www.biglist.com/lists/lists.mulberrytech.com/xsl-list/archives/201007/msg00094.html which has been partly resolved using catalog.xml when looking up the main source in Java as follows:



SAXBuilder stateSaxBuilder = new SAXBuilder("org.ccil.cowan.tagsoup.Parser", false);

org.jdom.Document xhtmlmainjdomDocument = saxBuilder.build(originalHTMLFILE);


Transformer transformer = TransformerFactory.newTransformer(new StreamSource(masterdox1.xsl));

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="/">

9 <html>

10 <head>

11 <title><xsl:value-of select="/report/title"/></title>

12 </head>

13 <body style="font-family: sans-serif;">

14 <h1>Selected Purchase Orders - Unsorted</h1>

15 <xsl:for-each select="/report/po">

16 <xsl:apply-templates

17 select="document(@filename)/purchase-order"/>

18 </xsl:for-each>

19 </body>

20 </html>

21 </xsl:template>



Any assistance would be much appreciated.