<?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>28662</bug_id>
          
          <creation_ts>2015-05-20 14:47:38 +0000</creation_ts>
          <short_desc>Editorial: Example for fn:json-to-xml</short_desc>
          <delta_ts>2016-12-16 19:55:15 +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>Functions and Operators 3.1</component>
          <version>Candidate Recommendation</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</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>minor</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Christian Gruen">christian.gruen</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>120385</commentid>
    <comment_count>0</comment_count>
    <who name="Christian Gruen">christian.gruen</who>
    <bug_when>2015-05-20 14:47:38 +0000</bug_when>
    <thetext>In the &quot;Examples&quot; section of fn:json-to-xml, it&apos;s a bit surprising to have code in the XSLT syntax. Maybe it could be replaced with the following equivalent example:

  let $jsonstr := unparsed-text(&apos;http://example.com/endpoint&apos;)
  let $options := map {
    &apos;liberal&apos;: true(),
    &apos;fallback&apos;: function($char as xs:string) as xs:string {
      let $c0chars := map {
        &apos;\u0000&apos;:&apos;[NUL]&apos;,
        &apos;\u0001&apos;:&apos;[SOH]&apos;,
        &apos;\u0002&apos;:&apos;[STX]&apos;,
        ...
        &apos;\u001E&apos;:&apos;[RS]&apos;,
        &apos;\u001F&apos;:&apos;[US]&apos;
      }
      let $replacement := $c0chars($char)
      return if (exists($replacement))
        then $replacement
        else error(xs:QName(&apos;err:invalid-char&apos;), 
          &apos;Error: &apos; || $char || &apos; is not a terminal control char.&apos;)
    }
  }
  return json-to-xml($jsonstr, $options)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>120598</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2015-05-29 10:13:06 +0000</bug_when>
    <thetext>Thanks for the suggestion. The XSLT example was there because of my laziness when moving the spec from XSLT 3.0. I have adopted your revision, except to replace

let $x:=A let $y:=B return C

by

let $x:=A, $y:=B return C

to make it valid in XPath as well as XQuery.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>