Project

Profile

Help

Bug #2084

closed

Failed to execute an XSLT 3.0 stylesheet that uses the 'parse-xml-fragment' function

Added by Radu Pisoi almost 10 years ago. Updated almost 10 years ago.

Status:
Closed
Priority:
Low
Category:
Internals
Sprint/Milestone:
-
Start date:
2014-06-02
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

The transformation of an XSLT 3.0 stylesheet that uses the parse-xml-fragment function fails if an external XML parser is provided. The custom XML parser should have an EntityResolver set.

To reproduce the problem you can execute from command line the following transformation:

d:\workspace\eXml>java -Xmx180m -Xss4096k -Xms48m -cp d:\workspace\eXml\lib\saxon9ee.jar;d:\workspace\eXml\lib\custom_parser.jar net.sf.saxon.
Transform -xsl:samples/test.xsl -s:samples/personal.xml -x:ro.sync.exml.test.XMLReaderWrapper
Error
  FODC0006: First argument to parse-xml-fragment() is not a well-formed and
  namespace-well-formed XML fragment. XML parser reported: I/O error reported by XML parser
  processing file:/d:/workspace/eXml/samples/test.xsl: Connection timed out: connect
Transformation failed: Run-time errors were reported

test.xsl


<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
        <xsl:sequence 
            select="parse-xml-fragment('&lt;testFragment&gt;test&lt;/testFragment&gt;')"/>
    </xsl:template>
</xsl:stylesheet> 

The custom XML reader, XMLReaderWrapper, could be found as attachment. It is a simple implementation that wraps an XMLReader obtained using SAXParserFactory. The entity resolver has the following implementation:

  private EntityResolver entityResolver = new EntityResolver() {    
    @Override
    public InputSource resolveEntity(String publicId, String systemId) throws SAXException,
        IOException {
      return null;
    }
  };

Files

custom_parser.jar (2.43 KB) custom_parser.jar Radu Pisoi, 2014-06-02 16:13
XMLReaderWrapper.java (6.4 KB) XMLReaderWrapper.java Radu Pisoi, 2014-06-02 16:14

Please register to edit this issue

Also available in: Atom PDF