XML-beyond-Scheme.xhtml 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2. <!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg">
  3. <head>
  4. <title>Using non-Scheme languages for XML/HTML</title>
  5. <link rel="stylesheet" type="text/css" href="docbook-epub.css"/>
  6. <link rel="stylesheet" type="text/css" href="kawa.css"/>
  7. <script src="kawa-ebook.js" type="text/javascript"/>
  8. <meta name="generator" content="DocBook XSL-NS Stylesheets V1.79.1"/>
  9. <link rel="prev" href="Overall-Index.xhtml" title="Index"/>
  10. <link rel="next" href="Miscellaneous.xhtml" title="Miscellaneous topics"/>
  11. </head>
  12. <body>
  13. <header/>
  14. <section class="sect1" title="Using non-Scheme languages for XML/HTML" epub:type="subchapter" id="XML-beyond-Scheme">
  15. <div class="titlepage">
  16. <div>
  17. <div>
  18. <h2 class="title" style="clear: both">Using non-Scheme languages for XML/HTML</h2>
  19. </div>
  20. </div>
  21. </div>
  22. <section class="sect2" title="XQuery language" epub:type="division" id="idm139667870128192">
  23. <div class="titlepage">
  24. <div>
  25. <div>
  26. <h3 class="title">XQuery language</h3>
  27. </div>
  28. </div>
  29. </div>
  30. <p>Bundled with Kawa is a fairly complete implementation of W3C’s
  31. new <a class="ulink" href="http://www.w3c.org/XML/Query" target="_top">XML Query language</a>.
  32. If you start Kawa with the <code class="literal">--xquery</code> it selects the "XQuery"
  33. source language; this also prints output using XML syntax.
  34. See the <a class="ulink" href="http://www.gnu.org/software/qexo/" target="_top">Qexo (Kawa-XQuery) home page</a>
  35. for examples and more information.
  36. </p>
  37. </section>
  38. <section class="sect2" title="XSL transformations" epub:type="division" id="idm139667870124432">
  39. <div class="titlepage">
  40. <div>
  41. <div>
  42. <h3 class="title">XSL transformations</h3>
  43. </div>
  44. </div>
  45. </div>
  46. <p>There is an experimental implementation of the XSLT (XML Stylesheet
  47. Language Transformations) language. Selecting <code class="literal">--xslt</code> at the
  48. Kawa command line will parse a source file according to the syntax
  49. on an XSLT stylesheet.
  50. See the <a class="ulink" href="http://www.gnu.org/software/qexo/xslt.html" target="_top">Kawa-XSLT page</a>
  51. for more information.
  52. </p>
  53. </section>
  54. <section class="sect2" title="KRL - The Kawa Report Language for generating XML/HTML" epub:type="division" id="KRL">
  55. <div class="titlepage">
  56. <div>
  57. <div>
  58. <h3 class="title">KRL - The Kawa Report Language for generating XML/HTML</h3>
  59. </div>
  60. </div>
  61. </div>
  62. <p>KRL (the "Kawa Report Language") is powerful Kawa dialect for embedding
  63. Scheme code in text files such as HTML or XML templates. You select
  64. the KRL language by specifying <code class="literal">--krl</code> on the Kawa command line.
  65. </p>
  66. <p>KRL is based on on <a class="ulink" href="http://brl.sourceforge.net/" target="_top">BRL</a>,
  67. Bruce Lewis’s "Beautiful Report Language", and
  68. uses some of BRL’s code, but there are some experimental differences,
  69. and the implementation core is different. You can run KRL in
  70. BRL-compatility-mode by specifying <code class="literal">--brl</code> instead of <code class="literal">--krl</code>.
  71. </p>
  72. </section>
  73. <section class="sect2" title="Differences between KRL and BRL" epub:type="division" id="idm139667870116400">
  74. <div class="titlepage">
  75. <div>
  76. <div>
  77. <h3 class="title">Differences between KRL and BRL</h3>
  78. </div>
  79. </div>
  80. </div>
  81. <p>This section summarizes the known differences between KRL and BRL.
  82. Unless otherwise specified, KRL in BRL-compatibility mode will
  83. act as BRL.
  84. </p>
  85. <div class="itemizedlist" epub:type="list">
  86. <ul class="itemizedlist" style="list-style-type: disc; ">
  87. <li class="listitem" epub:type="list-item">
  88. <p>In BRL a normal Scheme string <code class="literal">"mystring"</code> is the same
  89. as the inverted quote string <code class="literal">]mystring[</code>, and both are instances
  90. of the type <code class="literal">&lt;string&gt;</code>.
  91. In KRL <code class="literal">"mystring"</code> is a normal Scheme string of type <code class="literal">&lt;string&gt;</code>,
  92. but <code class="literal">]mystring[</code> is special type that suppresses output escaping.
  93. (It is equivalent to <code class="literal">(unescaped-data "mystring")</code>.)
  94. </p>
  95. </li>
  96. <li class="listitem" epub:type="list-item">
  97. <p>When BRL writes out a string, it does not do any processing
  98. to escape special characters like <code class="literal">&lt;</code>. However, KRL in its default
  99. mode does normally escape characters and strings. Thus <code class="literal">"&lt;a&gt;"</code>
  100. is written as <code class="literal">&amp;lt;a&amp;gr;</code>.
  101. You can stop it from doing this by overriding the output format, for example
  102. by specifying <code class="literal">--output-format scheme</code> on the Kawa command line,
  103. or by using the <code class="literal">unescaped-data</code> function.
  104. </p>
  105. </li>
  106. <li class="listitem" epub:type="list-item">
  107. <p>Various Scheme syntax forms, including <code class="literal">lambda</code>,
  108. take a <a class="link" href="Bodies.xhtml#meta-body"><em class="replaceable"><code>body</code></em></a>, which is a list of one or more declarations and
  109. expressions. In normal Scheme and in BRL the value of a <em class="replaceable"><code>body</code></em>
  110. is the value of the last expression. In KRL the value of a <em class="replaceable"><code>body</code></em>
  111. is the concatenation of all the values of the expressions,
  112. as if using <code class="literal">values-append</code>.
  113. </p>
  114. </li>
  115. <li class="listitem" epub:type="list-item">
  116. <p>In BRL a word starting with a colon is a keyword.
  117. In KRL a word starting with a colon is an identifier, which by
  118. default is bound to the <code class="literal">make-element</code> function specialized
  119. to take the rest of the word as the tag name (first argument).
  120. </p>
  121. </li>
  122. <li class="listitem" epub:type="list-item">
  123. <p>BRL has an extensive utility library. Most of this has not yet been ported
  124. to KRL, even in BRL-compatibility mode.
  125. </p>
  126. </li>
  127. </ul>
  128. </div>
  129. </section>
  130. </section>
  131. <footer>
  132. <div class="navfooter">
  133. <ul>
  134. <li>
  135. <b class="toc">
  136. <a href="XML-beyond-Scheme.xhtml#idm139667870128192">XQuery language</a>
  137. </b>
  138. </li>
  139. <li>
  140. <b class="toc">
  141. <a href="XML-beyond-Scheme.xhtml#idm139667870124432">XSL transformations</a>
  142. </b>
  143. </li>
  144. <li>
  145. <b class="toc">
  146. <a href="XML-beyond-Scheme.xhtml#KRL">KRL - The Kawa Report Language for generating XML/HTML</a>
  147. </b>
  148. </li>
  149. <li>
  150. <b class="toc">
  151. <a href="XML-beyond-Scheme.xhtml#idm139667870116400">Differences between KRL and BRL</a>
  152. </b>
  153. </li>
  154. </ul>
  155. <p>
  156. Up: <a accesskey="u" href="XML-tools.xhtml">Working with XML and HTML</a></p>
  157. <p>
  158. Previous: <a accesskey="p" href="HTTP-response.xhtml">Generating HTTP responses</a></p>
  159. </div>
  160. </footer>
  161. </body>
  162. </html>