W3C

Namespace Document

Table of Contents

1 Introduction
2 XML Schema
3 Normative References
4 Non-Normative References


1 Introduction

This document describes the namespace http://www.w3.org/2013/XSL/json/. This namespace is used in the XSLT 3.0 specification as the target namespace of an XML vocabulary used for a faithful representation of the information content of a JSON text.

This document describes the names that are defined in this namespace at the time of publication. The W3C reserves the right to define additional names in this namespace in the future. For updated information, please refer to the latest version of the relevant specification.

This document contains a directory of links to related resources, using RDDL (as defined in [Resource Directory Description Language (RDDL)]).

It is GRDDL-enabled (as defined in [Gleaning Resource Descriptions from Dialects of Languages (GRDDL)]), that is to say that a GRDDL-compliant processor can extract useful RDF (as defined in [Resource Description Framework (RDF): Concepts and Abstract Syntax]) representations of the information contained herein.

2 XML Schema

The function fn:json-to-xml() converts a JSON text to an XML representation, whose results that are always valid according to an XML Schema specified in [XSLT 3.0].

The schema is reproduced below:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="qualified"
    targetNamespace="http://www.w3.org/2013/XSL/json"
    xmlns:j="http://www.w3.org/2013/XSL/json">
    
    <!-- 
     * This is a schema for the XML representation of JSON used as the target for the
     * XSLT 3.0 function fn:json-to-xml()
     *
     * The schema is made available under the terms of the W3C software notice and license
     * at http://www.w3.org/Consortium/Legal/copyright-software-19980720
     *
    -->
    
    <xs:element name="map" type="j:mapType">
        <xs:unique name="unique-key">
            <xs:selector xpath="*"/>
            <xs:field xpath="@key"/>
        </xs:unique>
    </xs:element>
    
    <xs:element name="array" type="j:arrayType"/>
    
    <xs:element name="string" type="j:stringType"/>
    
    <xs:element name="number" type="j:numberType"/>
    
    <xs:element name="boolean" type="xs:boolean"/>
    
    <xs:element name="null" type="j:nullType"/>
    
    <xs:complexType name="nullType">
        <xs:sequence/>
    </xs:complexType>
    
    <xs:complexType name="stringType">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="escaped" type="xs:boolean" use="optional" default="false"/>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>
    
    <xs:simpleType name="numberType">
        <xs:restriction base="xs:double">
            <!-- exclude positive and negative infinity, and NaN -->
            <xs:minExclusive value="-INF"/>
            <xs:maxExclusive value="INF"/>
        </xs:restriction>
    </xs:simpleType>
    
    <xs:complexType name="arrayType">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element ref="j:map"/>
            <xs:element ref="j:array"/>
            <xs:element ref="j:string"/>
            <xs:element ref="j:number"/>
            <xs:element ref="j:boolean"/>
            <xs:element ref="j:null"/>
        </xs:choice>       
    </xs:complexType>
    
    <xs:complexType name="mapType">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element name="map">
                <xs:complexType>
                    <xs:complexContent>
                        <xs:extension base="j:mapType">
                            <xs:attribute name="key" type="xs:string"/>
                        </xs:extension>
                    </xs:complexContent>
                </xs:complexType>
                <xs:unique name="unique-key-2">
                    <xs:selector xpath="*"/>
                    <xs:field xpath="@key"/>
                </xs:unique>
            </xs:element>
            <xs:element name="array">
                <xs:complexType>
                    <xs:complexContent>
                        <xs:extension base="j:arrayType">
                            <xs:attributeGroup ref="j:key-group"/>
                        </xs:extension>
                    </xs:complexContent>
                </xs:complexType>
            </xs:element>
            <xs:element name="string">
                <xs:complexType>
                    <xs:simpleContent>
                        <xs:extension base="j:stringType">
                            <xs:attributeGroup ref="j:key-group"/>
                        </xs:extension>
                    </xs:simpleContent>
                </xs:complexType>
            </xs:element>
            <xs:element name="number">
                <xs:complexType>
                    <xs:simpleContent>
                        <xs:extension base="j:numberType">
                            <xs:attributeGroup ref="j:key-group"/>
                        </xs:extension>
                    </xs:simpleContent>
                </xs:complexType>
            </xs:element>
            <xs:element name="boolean">
                <xs:complexType>
                    <xs:simpleContent>
                        <xs:extension base="xs:boolean">
                            <xs:attributeGroup ref="j:key-group"/>
                        </xs:extension>
                    </xs:simpleContent>
                </xs:complexType>
            </xs:element>
            <xs:element name="null">
                <xs:complexType>
                    <xs:attributeGroup ref="j:key-group"/>
                </xs:complexType>
            </xs:element>
        </xs:choice>
    </xs:complexType>
    
    <xs:attributeGroup name="key-group">
        <xs:attribute name="key" type="xs:string"/>
        <xs:attribute name="escaped-key" type="xs:boolean" use="optional" default="false"/>
    </xs:attributeGroup>
    
</xs:schema>

This schema specifies the XML syntax of the result returned by fn:json-to-xml as defined in [XSLT 3.0]. It is located at http://www.w3.org/TR/2013/WD-xslt-30-20131212/schema-for-json.xsd.

3 Normative References

These documents describe the names that are defined in this namespace at the time of publication. The W3C reserves the right to define additional names in this namespace in the future.

XSLT 3.0

XSLT 3.0 (12 December 2013 version)

4 Non-Normative References

Resource Directory Description Language (RDDL)
Gleaning Resource Descriptions from Dialects of Languages (GRDDL)
Resource Description Framework (RDF): Concepts and Abstract Syntax