<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>29602</bug_id>
          
          <creation_ts>2016-04-29 14:07:51 +0000</creation_ts>
          <short_desc>[xslt30] xml-to-json() - inconsistency between XSLT30 and XP31 specs</short_desc>
          <delta_ts>2016-10-06 18:42:23 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XPath / XQuery / XSLT</product>
          <component>XSLT 3.0</component>
          <version>Candidate Recommendation</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Kay">mike</reporter>
          <assigned_to name="Michael Kay">mike</assigned_to>
          
          
          <qa_contact name="Mailing list for public feedback on specs from XSL and XML Query WGs">public-qt-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>126303</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-04-29 14:07:51 +0000</bug_when>
    <thetext>The current XSLT 3.0 version of xml-to-json() has a fallback option; the current XPath 3.1 version does not.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>126305</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-04-29 21:10:39 +0000</bug_when>
    <thetext>The fallback option was dropped as a result of the decision (of the Joint WGs) recorded here:

https://www.w3.org/Bugs/Public/show_bug.cgi?id=28181

Although this decision was made in March 2015, the changes somehow didn&apos;t find their way into the XSLT 3.0 CR. This clearly illustrates the challenge we have given ourselves by replicating material across the F+O 3.1 and XSLT 3.0 specifications.

Getting the two specs back into line for xml-to-json() isn&apos;t completely trivial:

(a) the F+O 3.1 spec refers to the &quot;option parameter conventions&quot; which define the common (cross-function) rules for option parameters. Do we replicate these in the XSLT 3.0 specification?

(b) we still provide XSLT stylesheets which we claim are equivalent to the xml-to-json() function specification. However, as the function specification has evolved, the stylesheet has not been updated. There are numerous details where its behaviour differs, although most can be considered edge cases. For example, it does not throw an error if a j:string element has child elements; it treats all values of the &quot;indent&quot; option other than true() as false(), rather than throwing an error; it doesn&apos;t accurately follow the escaping rules; it makes no attempt to detect duplicate keys in a map; it reports incorrect error codes if the input is invalid.

My firm preference for resolving these issues would be to specify this and similar functions by means of a normative reference to the F+O 3.1 specification.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>126421</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-05-12 10:32:18 +0000</bug_when>
    <thetext>The problem with the xml-to-json stylesheets can be solved, I think, by changing text in para 2 of 22.4. Instead of &quot;is functionally identical to the xml-to-json function described in the previous section&quot; we should say 

&quot;has largely similar behavior to the xml-to-json function described in the previous section. (It should not be regarded as a conformant implementation of that function: for example, it does not perform complete validation of the input, and it does not follow the escaping rules precisely.)&quot;

The problem with the option parameter conventions is trickier. Reproducing the OPCs in the XSLT 3.0 spec is overkill and increases the risk of inconsistencies creeping in. I do think we should bite the bullet and reference F+O 3.1 normatively.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>126589</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-05-26 16:42:47 +0000</bug_when>
    <thetext>We resolved:

(a) to retain a self-standing spec of xml-to-json in the XSLT 3.0 spec without referencing F+O 3.1

(b) this involves copying the section on option parameter conventions even though it could be regarded as overkill for this one function

(c) we retain the stylesheets in the spec but downgrade the claim that they are a conformant implementation of the function as specified.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>126590</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-05-26 16:45:33 +0000</bug_when>
    <thetext>Further, we resolved to copy the current spec from F+O 3.1 into XSLT (which means, for example, dropping the fallback option)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>126591</commentid>
    <comment_count>5</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-05-26 21:10:25 +0000</bug_when>
    <thetext>The proposal was accepted and the changes have been applied.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>