## /home/wolf/Devel/Sandbox/eXist-0.8/src/org/exist
Stylesheet xmldb.xsl

    /home/wolf/Devel/Sandbox/eXist-0.8/src/org/exist/xmldb.xsl

stylesheet xmldb.xsl
xslt version 1.0

XSP logicsheet for eXist. This logicsheet is based on the XML:DB API. It should basically work with other database products implementing the API, however it has only been tested with eXist.

Variable Summary
`namespace-uri`
`prefix`
`xsp-uri = 'http://apache.org/xsp'`

Template Summary
`"@*|node()"`
`"xmldb:collection//xmldb:create-collection"` Create a new subcollection in the current collection.
`"xmldb:collection//xmldb:execute"` Execute a XPath query on the current collection.
`"xmldb:collection//xmldb:get-collection"` Returns the current collection object.
`"xmldb:collection//xmldb:get-document"` Retrieve a document from the current collection.
`"xmldb:collection//xmldb:get-resource-count"` Get the number of resources contained in the current collection
`"xmldb:collection//xmldb:get-subcollection-count"` Get the number of subcollections in the current collection.
`"xmldb:collection//xmldb:remove-collection"` Remove a subcollection from the current collection.
`"xmldb:collection//xmldb:remove-document"` Remove a document from the current collection.
`"xmldb:collection//xmldb:resource-name[@count|xmldb:count]"`
`"xmldb:collection[not(ancestor::xmldb:results)]"` Retrieve a collection object from the database.
`"xmldb:documents//xmldb:document-hit-count"` Get the number of hits found for the document currently selected by the xmldb:documents iterator
`"xmldb:documents//xmldb:document-name"` Get the name of the document currently selected by the xmldb:documents iterator
`"xmldb:driver"` Register a driver class with the XML:DB DatabaseManager
`"xmldb:error|xmldb:xpath|xmldb:uri|xmldb:as|xmldb:count|xmldb:position"`
`"xmldb:execute//xmldb:get-hit-count[@document or xmldb:document]"` Get the number of hits found for a specified document or collection
`"xmldb:execute//xmldb:get-hit-count[not(@document or xmldb:document)]"` Get the number of hits generated by the query
`"xmldb:execute//xmldb:get-query-time"` Returns the query execution time needed to process the query.
`"xmldb:execute//xmldb:results[@document|xmldb:document]"` Iterate over the result set items in the current result set.
`"xmldb:execute//xmldb:results[not(@document|xmldb:document)]"` Iterate over the result set items in the current result set.
`"xmldb:execute//xmldb:result-summary"` Create a summary of hits by collection and start iterating over it.
`"xmldb:get-error"`
`"xmldb:get-error-description"`
`"xmldb:resources//xmldb:resource-name"` Get the name of the resource currently selected by the xmldb:resources iterator.
`"xmldb:resources"` Iterate over the list of resources contained in the current collection.
`"xmldb:results//xmldb:collection|xmldb:results//xmldb:document"`
`"xmldb:results//xmldb:document-name"`
`"xmldb:results//xmldb:get-xml"` Retrieve a result set item from the current result set.
`"xmldb:results//xmldb:parent-collection"`
`"xmldb:result-summary//xmldb:collection-name"` Get the name of the collection which is currently processed by the result-summary iterator.
`"xmldb:result-summary//xmldb:documents"` Get the documents for which hits have been found in the collection currently selected by the result-summary iterator.
`"xmldb:store"` Store a document into the database.
`"xmldb:subcollections//xmldb:child-collection-name"` Get the name of the current subcollection selected by the xmldb:subcollections iterator.
`"xmldb:subcollections"` Iterate over the list of subcollections contained in the current collection.
`"xmldb:uri"`
`"xsp:page"`
`error(message)`
`get-nested-content(content)`
`get-parameter(name, default, required)` This is a utility template to retrieve parameters passed to other templates.
`get-parameter-content(content)`

Variable Detail

### namespace-uri

    namespace-uri

### prefix

    prefix

### xsp-uri

    xsp-uri = 'http://apache.org/xsp'

Template Detail

### "xsp:page"

    Matches:"xsp:page"

### "xmldb:driver"

    Matches:"xmldb:driver"

  Register a driver class with the XML:DB DatabaseManager
  Parameters:
    `class` - the name of the driver class. Default: org.exist.xmldb.LocalDatabase

### "xmldb:collection[not(ancestor::xmldb:results)]"

    Matches:"xmldb:collection[not(ancestor::xmldb:results)]"

  Retrieve a collection object from the database. As required by the XML:DB API, every action has to be enclosed in an xmldb:collection element. All child elements operate on this collection.
  Parameters:
    `uri` - The fully qualified URI of the collection.

### "xmldb:collection//xmldb:get-collection"

    Matches:"xmldb:collection//xmldb:get-collection"

  Returns the current collection object.
  Returns:
    the current collection object

### "xmldb:collection//xmldb:execute"

    Matches:"xmldb:collection//xmldb:execute"

  Execute a XPath query on the current collection.
  Parameters:
    `xpath` - the XPath expression to execute.
    `encoding` - the character encoding used by enclosed tags. Default: ISO-8859-1.

### "xmldb:execute//xmldb:get-query-time"

    Matches:"xmldb:execute//xmldb:get-query-time"

  Returns the query execution time needed to process the query.
  Returns:
    query execution time in ms.
  See Also:
    `xmldb:collection//xmldb:execute()`

### "xmldb:execute//xmldb:result-summary"

    Matches:"xmldb:execute//xmldb:result-summary"

  Create a summary of hits by collection and start iterating over it.
  See Also:
    `xmldb:collection//xmldb:execute()`

### "xmldb:result-summary//xmldb:collection-name"

    Matches:"xmldb:result-summary//xmldb:collection-name"

  Get the name of the collection which is currently processed by the result-summary iterator.
  Returns:
    the name of the current collection.
  See Also:
    `xmldb:execute//xmldb:result-summary()`

### "xmldb:result-summary//xmldb:documents"

    Matches:"xmldb:result-summary//xmldb:documents"

  Get the documents for which hits have been found in the collection currently selected by the result-summary iterator.
  Returns:
    Iterator over all documents in the current collection.
  See Also:
    `xmldb:execute//xmldb:result-summary()`

### "xmldb:documents//xmldb:document-hit-count"

    Matches:"xmldb:documents//xmldb:document-hit-count"

  Get the number of hits found for the document currently selected by the xmldb:documents iterator
  See Also:
    `xmldb:result-summary//xmldb:documents()`

### "xmldb:documents//xmldb:document-name"

    Matches:"xmldb:documents//xmldb:document-name"

  Get the name of the document currently selected by the xmldb:documents iterator
  See Also:
    `xmldb:result-summary//xmldb:documents()`

### "xmldb:execute//xmldb:results[@document|xmldb:document]"

    Matches:"xmldb:execute//xmldb:results[@document|xmldb:document]"

  Iterate over the result set items in the current result set. Select only those items which belong to the specified document or collection.
  Parameters:
    `pos` - the position of the first result set item to select.
    `count` - the number of items to iterate over, beginning at pos.
    `document` - the name of the document for which results should be retrieved. If null, all documents in the collection will be selected.
    `collection` - the name of the collection for which results should be retrieved.
  See Also:
    `#"xmldb:execute//xmldb:results[not(@document|xmldb:document)]"`

### "xmldb:execute//xmldb:results[not(@document|xmldb:document)]"

    Matches:"xmldb:execute//xmldb:results[not(@document|xmldb:document)]"

  Iterate over the result set items in the current result set.
  Parameters:
    `pos` - the position of the first result set item to select.
    `count` - the number of items to iterate over, beginning at pos.
    `document` - the name of the document for which results should be retrieved. If null, all documents in the collection will be selected.
    `collection` - the name of the collection for which results should be retrieved.
  See Also:
    `xmldb:execute//xmldb:results[@document|xmldb:document]()`

### "xmldb:results//xmldb:document-name"

    Matches:"xmldb:results//xmldb:document-name"

### "xmldb:results//xmldb:parent-collection"

    Matches:"xmldb:results//xmldb:parent-collection"

### "xmldb:results//xmldb:get-xml"

    Matches:"xmldb:results//xmldb:get-xml"

  Retrieve a result set item from the current result set. The item is inserted into the document at the current position.
  Parameters:
    `as` - if set to "string", the item will be included as string value, which means that the XML markup is escaped. If set to "xml", the item will be inserted into the current SAX stream processed by Cocoon. This allows to post-process the generated results.
  See Also:
    `#"xmldb:execute//xmldb:results[not(@document|xmldb:document)]"`, `xmldb:execute//xmldb:results[@document|xmldb:document]()`

### "xmldb:collection//xmldb:remove-document"

    Matches:"xmldb:collection//xmldb:remove-document"

  Remove a document from the current collection.
  Parameters:
    `name` - the name of the document to remove.

### "xmldb:collection//xmldb:remove-collection"

    Matches:"xmldb:collection//xmldb:remove-collection"

  Remove a subcollection from the current collection.
  Parameters:
    `name` - the name of the subcollection to remove.

### "xmldb:collection//xmldb:create-collection"

    Matches:"xmldb:collection//xmldb:create-collection"

  Create a new subcollection in the current collection.
  Parameters:
    `name` - the name of the new subcollection.

### "xmldb:collection//xmldb:get-document"

    Matches:"xmldb:collection//xmldb:get-document"

  Retrieve a document from the current collection.
  Parameters:
    `name` - the name of the document.
    `as` - if set to "string", the document's content will be included as string, escaping all XML markup. If set to "xml", it will be inserted into the current SAX stream provided by Cocoon.
    `encoding` - the character encoding to use for the retrieved document data.

### "xmldb:execute//xmldb:get-hit-count[not(@document or xmldb:document)]"

    Matches:"xmldb:execute//xmldb:get-hit-count[not(@document or xmldb:document)]"

  Get the number of hits generated by the query
  See Also:
    `#"xmldb:execute"`

### "xmldb:execute//xmldb:get-hit-count[@document or xmldb:document]"

    Matches:"xmldb:execute//xmldb:get-hit-count[@document or xmldb:document]"

  Get the number of hits found for a specified document or collection
  Parameters:
    `document` - the document for which to return the number of hits. If null, the number of hits for the specified collection is returned. Default: null.
    `collection` - the collection for which to return the number of hits.
  See Also:
    `#"xmldb:execute"`

### "xmldb:get-error-description"

    Matches:"xmldb:get-error-description"

### "xmldb:get-error"

    Matches:"xmldb:get-error"

### "xmldb:uri"

    Matches:"xmldb:uri"

### "xmldb:subcollections"

    Matches:"xmldb:subcollections"

  Iterate over the list of subcollections contained in the current collection.

### "xmldb:collection//xmldb:get-subcollection-count"

    Matches:"xmldb:collection//xmldb:get-subcollection-count"

  Get the number of subcollections in the current collection.

### "xmldb:subcollections//xmldb:child-collection-name"

    Matches:"xmldb:subcollections//xmldb:child-collection-name"

  Get the name of the current subcollection selected by the xmldb:subcollections iterator.
  See Also:
    `xmldb:subcollections()`

### "xmldb:collection//xmldb:get-resource-count"

    Matches:"xmldb:collection//xmldb:get-resource-count"

  Get the number of resources contained in the current collection

### "xmldb:collection//xmldb:resource-name[@count|xmldb:count]"

    Matches:"xmldb:collection//xmldb:resource-name[@count|xmldb:count]"

### "xmldb:resources"

    Matches:"xmldb:resources"

  Iterate over the list of resources contained in the current collection. Usage:

      <xmldb:collection name="xmldb:exist:///db">
      <xmldb:resources>
      <li><xmldb:resource-name/></li>
      </xmldb:resources>
      </xmldb:collection>

### "xmldb:resources//xmldb:resource-name"

    Matches:"xmldb:resources//xmldb:resource-name"

  Get the name of the resource currently selected by the xmldb:resources iterator.
  See Also:
    `xmldb:resources()`

### "xmldb:store"

    Matches:"xmldb:store"

  Store a document into the database. Usage:

      <xmldb:collection name="xmldb:exist:///db">
      <xmldb:store name="test.xml" overwrite="true">
      <xmldb:xml>data</xmldb:xml>
      </xmldb:store>
      </xmldb:collection>

  Parameters:
    `name` - the name of the document to create. If null, a unique name will be automatically generated.
    `xml` - the xml contents of the document.
    `overwrite` - if set to "true", an existing document with the same name will be overwritten.

### "xmldb:error|xmldb:xpath|xmldb:uri|xmldb:as|xmldb:count|xmldb:position"

    Matches:"xmldb:error|xmldb:xpath|xmldb:uri|xmldb:as|xmldb:count|xmldb:position"

### "xmldb:results//xmldb:collection|xmldb:results//xmldb:document"

    Matches:"xmldb:results//xmldb:collection|xmldb:results//xmldb:document"

### "@*|node()"

    Matches:"@*|node()"

### get-parameter

    Name: get-parameter(name,
                  default,
                  required)

  This is a utility template to retrieve parameters passed to other templates.

### get-parameter-content

    Name: get-parameter-content(content)

### get-nested-content

    Name: get-nested-content(content)

### error

    Name: error(message)