Project

Profile

Help

Bug #3223

closed

Supplying Document objects to JavaScript global functions

Added by Debbie Lockett over 7 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Category:
-
Sprint/Milestone:
-
Start date:
2017-05-16
Due date:
% Done:

100%

Estimated time:
Applies to JS Branch:
1.0, Trunk
Fix Committed on JS Branch:
1.0, Trunk
Fixed in JS Release:
SEF Generated with:
Platforms:
Company:
-
Contact person:
-
Additional contact persons:
-

Description

Problem arising from working on finding a way to use XMLHttpRequest to make POST requests with XML content. Having encountered difficulties myself while working on the License Tool application, part of the problem is now pinned down with the help of a user support question.

We currently have an issue in Saxon-JS in that we always use DocumentFragment objects (rather than Document, or even XMLDocument, objects) when dealing with chunks of XML (or XHTML). For instance an xsl:document instruction (see newDoc() in Expr.js) will currently always produce a DocumentFragment. So when we want to pass a Document to a JavaScript function (like XMLHttpRequest.send()) we have a problem.

<xsl:template match="button[@id eq 'submit']" mode="ixsl:onclick">
    <xsl:variable name="xmldoc" as="document-node(element(doc))" xmlns="">
      <xsl:document>
        <doc>
...

        </doc>
      </xsl:document>
    </xsl:variable>
    <xsl:sequence select="js:postFn($xmldoc)"/>
  </xsl:template>

In cases such as the above, where the xsl:document is inside an xsl:variable with defined type document-node(), certainly we could be able creating an XMLDocument instead.

(A work around is to do more in the JavaScript function, to copy the content of the DocumentFragment into an XMLDocument; but Saxon-JS should really do this in the first place.)

Please register to edit this issue

Also available in: Atom PDF Tracking page