|
* {{Code|convert:dayTime-to-integer(xs:dayTimeDuration('PT1S'))}} yields {{Code|1000}}.
|}
=Keys=
==convert:decode-key==
{{Mark|Introduced with Version 9.4:}}
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|convert:decode-key|$key as xs:string|xs:string}}<br />{{Func|convert:decode-key|$key as xs:string, $lax as xs:boolean|xs:string}}<br />
|-
| '''Summary'''
|Decodes the specified {{Code|$key}} to its original string representation, using the optional {{Code|$lax}} conversion method.<br />Keys supplied to this function are usually element names from documents that have been created with the [[JSON Module]] and the [[CSV Module]] and the {{Code|direct}} conversion format.
|-
| '''Examples'''
|
* <code>convert:decode-key('_0021'))</code> yields <code>!</code>.
* <code>json:doc("doc.json")//* ! convert:decode-key(name())</code> yields the original string representation of all names of a JSON document.
|}
==convert:encode-key==
{{Mark|Introduced with Version 9.4:}}
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|convert:encode-key|$key as xs:string|xs:string}}<br />{{Func|convert:encode-key|$key as xs:string, $lax as xs:boolean|xs:string}}<br />
|-
| '''Summary'''
|Encodes the specified {{Code|$key}} to a format that can be used to create an element node, using the optional {{Code|$lax}} conversion method.<br />The encoding is the same that is used in the [[JSON Module]] and the [[CSV Module]] and the {{Code|direct}} conversion format.
|-
| '''Examples'''
|
* <code>element { convert:encode-key("!") } { 'text' }</code> creates a new element with an encoded name key.
|}
=Changelog=
;Version 9.4
* Added: [[#convert:name-to-key|convert:name-to-key]], [[#convert:key-to-name|convert:key-to-name]].
;Version 9.0