<?xml version="1.0"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->

<!--+
    | Populates XMLDB with some samples data
    | CVS $Id: populate.xml 433543 2006-08-22 06:22:54Z crossley $
    +-->

<html>
  <h2>Populating XML:DB with sample data</h2>
  <h3>Create collection ...</h3>
  <p>Create collection should succeed on the first run, but will fail on subsequent runs</p>
  <textarea cols="75" rows="3">
    <x:query type="create" oid="cocoon/" xmlns:x="http://apache.org/cocoon/xmldb/1.0"/>
  </textarea>

  <h3>Import sitemap.xmap ...</h3>
  <textarea cols="75" rows="3">
    <x:query type="create" collection="cocoon" oid="sitemap" xmlns:x="http://apache.org/cocoon/xmldb/1.0">
      <i:include src="sitemap.xmap" xmlns:i="http://apache.org/cocoon/include/1.0"/>
    </x:query>
  </textarea>
      
  <h3>Import xmldb2samples.xsl ...</h3>
  <textarea cols="75" rows="3">
    <x:query type="create" collection="cocoon" oid="xmldb2samples.xsl" xmlns:x="http://apache.org/cocoon/xmldb/1.0">
      <i:include src="xmldb2samples.xsl" xmlns:i="http://apache.org/cocoon/include/1.0"/>
    </x:query>
  </textarea>

  <h3>Import samples.xml ...</h3>
  <textarea cols="75" rows="3">
    <x:query type="create" collection="cocoon" oid="samples.xml" xmlns:x="http://apache.org/cocoon/xmldb/1.0">
      <i:include src="samples.xml" xmlns:i="http://apache.org/cocoon/include/1.0"/>
    </x:query>
  </textarea>

  <h3>Perform XUpdate on samples.xml ...</h3>
  <textarea cols="75" rows="3">
    <x:query type="update" collection="cocoon" oid="samples.xml" xmlns:x="http://apache.org/cocoon/xmldb/1.0">
      <xu:modifications version="1.0" xmlns:xu="http://www.xmldb.org/xupdate">
        <xu:remove select="/samples/group[@name = 'Init Database']"/>
        <xu:update select="/samples/group[@name = 'XMLDB Samples']/sample[@name='Mount DB']/@name">Mount FS</xu:update>
        <xu:update select="/samples/group[@name = 'XMLDB Samples']/sample[@name='Mount FS']/@href">..</xu:update>
        <xu:update select="/samples/group[@name = 'XMLDB Samples']/sample[@name='Mount FS']">
           Go back to the file system version of this page.
        </xu:update>
        <xu:append select="/samples/group[@name = 'XMLDB Samples']" child="1">
          <note>
            This sitemap, page, and XSLT stylesheet for browser, all are served from
            the XML:DB. Click below to go back to file system version.
          </note>
        </xu:append>
      </xu:modifications>
    </x:query>
  </textarea>

  <h3>Import samples.xml as xsamples.xml ...</h3>
  <textarea cols="75" rows="3">
    <x:query type="create" collection="cocoon" oid="xsamples.xml" xmlns:x="http://apache.org/cocoon/xmldb/1.0">
      <i:include src="samples.xml" xmlns:i="http://apache.org/cocoon/include/1.0"/>
    </x:query>
  </textarea>

  <h3>Perform XUpdate on xsamples.xml ...</h3>
  <textarea cols="75" rows="3">
    <x:query type="update" collection="cocoon" oid="xsamples.xml" xmlns:x="http://apache.org/cocoon/xmldb/1.0">
      <xu:modifications version="1.0" xmlns:xu="http://www.xmldb.org/xupdate">
        <xu:remove select="/samples/group[@name = 'XMLDB Samples']/sample[@name='Mount DB']"/>

        <xu:update select="/samples/group[@name = 'XMLDB Samples']/sample[@name='From DB']/@name">From File System</xu:update>
        <xu:update select="/samples/group[@name = 'XMLDB Samples']/sample[@name='From File System']/@href">welcome</xu:update>
        <xu:update select="/samples/group[@name = 'XMLDB Samples']/sample[@name='From File System']">
           Go back to the file system version of this page.
        </xu:update>
        <xu:append select="/samples/group[@name = 'XMLDB Samples']" child="1">
          <note>
            This page is served from the XML:DB. Click below to go back to file system
            version of the file.
          </note>
        </xu:append>
      </xu:modifications>
    </x:query>
  </textarea>

  <h3>Done</h3>
  <p>Review results of all operations and go check other samples.</p>
  <a href="./">Go Back</a>
</html>
