6. Examples

Examples of XSieve programs are stored in the folder example. They are executed during make check.

General rules on content of the examples:

Each example is accompanied by documentation:

6.1. Hello, World

This example demonstrates automatic conversion of data from the SXML format to XML.

Example 10. Example of a simple XSieve stylesheet

<x:stylesheet
  xmlns:x = "http://www.w3.org/1999/XSL/Transform"
  xmlns:s = "http://xsieve.sourceforge.net"
  extension-element-prefixes="s"
  version = "1.0">
<!-- -->

<x:output indent="yes"/>

<x:template match="/">
  <s:scheme>
    '(article (@ (id "hw"))
        (title "Hello")
        (para  "Hello, " (object "World") "!"))
  </s:scheme>
</x:template>

</x:stylesheet>

Applying the stylesheet to any XML file gives the following result.

<?xml version="1.0"?>
<article id="hw">
  <title>Hello</title>
  <para>Hello, <object>World</object>!</para>
</article>