Friday, 15 February 2013

java - How to disable DTD validation in XSL function 'document()' (xalan-j) -



java - How to disable DTD validation in XSL function 'document()' (xalan-j) -

xsl:

<?xml version='1.0' encoding='utf-8' ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:htm="http://www.w3.org/1999/xhtml" version="1.0"> <xsl:template match="/"> <xsl:variable name="source" select="document('test.html')"/> </xsl:template> </xsl:stylesheet>

test.html:

<?xml version="1.0" encoding="utf-8"?> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html lang="en-us" xml:lang="en-us"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> </head> <body> bla-bla-bla </body> </html>

when test.html contains doctype declaration, xsl transformation takes 2 minutes. when remove doctype declaration in test.html, xsl transformation takes 100 ms. there way in xalan-j disable dtd validation internal loading of xml via xsl document() function.

thanks in advance!

you don't need disable validation. need install either local caching proxy or catalog , local re-create of dtds utilize often.

the process taking long time because w3c serves dtd files slowly way of discouraging excessive dtd traffic.

use local catalog, or utilize local caching proxy.

java xslt dtd xalan

No comments:

Post a Comment