Loading TOC...

MarkLogic 12 EA 1 Product Documentation
spell:make-dictionary

spell:make-dictionary(
   $words as xs:string*,
   [$output-kind as xs:string]
) as item()

Summary

Creates a dictionary node from a sequence of words.

Parameters
words The words from which to construct a dictionary.
output-kind The kind of the returned dictionary node. If "element", an xml element is returned; if "object", a javascript object is returned.

The default value is "element".

Example

  xquery version "1.0-ml";
  import module namespace spell = "http://marklogic.com/xdmp/spell" 
		  at "/MarkLogic/spell.xqy";

  let $words := ("words", "to", "go", "in", "the", "dictionary")
  return 
  spell:make-dictionary($words)

  => 
  <dictionary xmlns="http://marklogic.com/xdmp/spell">
    <word>words</word>
    <word>to</word>
    <word>go</word>
    <word>in</word>
    <word>the</word>
    <word>dictionary</word>
  </dictionary>

  

Example

  xquery version "1.0-ml";
  import module namespace spell = "http://marklogic.com/xdmp/spell" 
		  at "/MarkLogic/spell.xqy";

  spell:make-dictionary(cts:words())

  => A spell:dictionary element containing all the words in the database.  
     Use spell:insert to insert this into the database as a dictionary.  
     This example requires a word lexicon on the database.  You can 
     construct the sequence of words any way you like.
  

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.