Project

Profile

Help

Bug #5081

closed

Result of serialize($someElement, map{}) contains XML declaration although function spec suggest default value is to omit-xml-declaration

Added by Martin Honnen over 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Low
Assignee:
-
Category:
XPath Conformance
Sprint/Milestone:
Start date:
2021-09-06
Due date:
% Done:

100%

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

Description

The fn:seriaiize spec at https://www.w3.org/TR/xpath-functions/#func-serialize defines that "If the second argument is supplied as a map ... The required type of each parameter, and its default value, are defined by the following table" saying

omit-xml-declaration	xs:boolean?	true() means "yes", false() means "no"	yes

For some reason, however, Saxon-JS 2.3 on both the browser side as well as in Node.js outputs an XML declaration e.g.

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="3.0"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  exclude-result-prefixes="#all"
  expand-text="yes">
  
  <xsl:output method="html" html-version="5.0" indent="yes"/>

  <xsl:template match="/" name="xsl:initial-template">
    <xsl:variable name="foo" as="element(foo)"><foo>test</foo></xsl:variable>
    <xsl:copy-of select="$foo"/>
    <section>
      <h2>serialize with empty map</h2>
      <pre>{serialize($foo, map{})}</pre>
    </section>
    <xsl:comment>Run with {system-property('xsl:product-name')} {system-property('xsl:product-version')} {system-property('Q{http://saxon.sf.net/}platform')}</xsl:comment>
  </xsl:template>
  
</xsl:stylesheet>

outputs (for Saxon JS 2.3 browser)

<foo>test</foo>
<section>
   <h2>serialize with empty map</h2>
   <pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;foo&gt;test&lt;/foo&gt;</pre>
</section>
<!--Run with Saxon-JS 2.3 Browser-->

Please register to edit this issue

Also available in: Atom PDF Tracking page