Update BaseX Higher Order Function module; add `hof:drop-while()`.

xquery version "3.0";
(:~
 : BaseX Higher Order Functions Module
 :
 : @see http://docs.basex.org/wiki/Higher-Order_Functions_Module
 :)
module namespace hof = "http://basex.org/modules/hof";

declare namespace a = "http://reecedunn.co.uk/xquery/annotations";
declare namespace o = "http://reecedunn.co.uk/xquery/options";

declare option o:requires "basex/7.0";

declare %a:since("basex", "7.0") function hof:fold-left1($seq as item()+, $f as function(item()*, item()) as item()*) as item()* external;
declare %a:since("basex", "7.0") function hof:until($pred as function(item()*) as xs:boolean, $f as function(item()*) as item()*, $start as item()*) as item()* external;
declare %a:since("basex", "8.1") function hof:scan-left($seq as item()*, $start as item()*, $f as function(item()*, item()) as item()*) as item()* external;
declare %a:since("basex", "8.1") function hof:take-while($seq as item()*, $pred as function(item()) as xs:boolean) as item()* external;
declare %a:since("basex", "7.2") function hof:top-k-by($seq as item()*, $sort-key as function(item()) as item(), $k as xs:integer) as item()* external;
declare %a:since("basex", "7.2") function hof:top-k-with($seq as item()*, $lt as function(item(), item()) as xs:boolean, $k as xs:integer) as item()* external;
declare %a:since("basex", "7.0") function hof:id($expr as item()*) as item()* external;
declare %a:since("basex", "7.0") function hof:const($expr as item()*, $ignored as item()*) as item()* external;
declare %a:since("basex", "7.0") %a:until("basex", "7.2") function hof:iterate($f as function(item()*, item()*) as item()*, $seq as item()*) as item()* external;
declare %a:since("basex", "9.5") function hof:drop-while($seq as item()*, $pred as function(item()) as xs:boolean) as item()* external;


Project template

Project template

xquery version "1.0-ml";

declare namespace c = "http://marklogic.com/program360/contract";
declare namespace ism = "urn:us:gov:ic:ism";
declare namespace p = "http://schemas.openxmlformats.org/presentationml/2006/main";
declare namespace a="http://schemas.openxmlformats.org/drawingml/2006/main";
declare namespace r = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
declare namespace sch = "http://marklogic.com/program360/schedule";

declare variable $PROJECT-URI as xs:string external;

let $project := fn:doc($PROJECT-URI)
let $classification := $project/*:component/*:name/@*:classification
let $slide :=
  <p:sld xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
    <p:cSld>
      <p:spTree>
        <p:nvGrpSpPr>
          <p:cNvPr id="1" name=""/>
          <p:cNvGrpSpPr/>
          <p:nvPr/>
        </p:nvGrpSpPr>
        <p:grpSpPr>
          <a:xfrm>
            <a:off x="0" y="0"/>
            <a:ext cx="0" cy="0"/>
            <a:chOff x="0" y="0"/>
            <a:chExt cx="0" cy="0"/>
          </a:xfrm>
        </p:grpSpPr>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="2" name="title"/>
            <p:cNvSpPr>
              <a:spLocks noGrp="1"/>
            </p:cNvSpPr>
            <p:nvPr>
              <p:ph type="ctrTitle"/>
            </p:nvPr>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="990600" y="228600"/>
              <a:ext cx="7772400" cy="614728"/>
            </a:xfrm>
            <a:noFill/>
          </p:spPr>
          <p:txBody>
            <a:bodyPr>
              <a:noAutofit/>
            </a:bodyPr>
            <a:lstStyle/>
            <a:p>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="3600"/>
                <a:t>{fn:concat(fn:concat("(",$classification),") ")} {$project/*:component/*:name/text()}</a:t>
              </a:r>
              <a:endParaRPr dirty="0" lang="en-US" sz="3600"/>
            </a:p>
          </p:txBody>
        </p:sp>
        <p:graphicFrame>
          <p:nvGraphicFramePr>
            <p:cNvPr id="11" name="Table 10"/>
            <p:cNvGraphicFramePr>
              <a:graphicFrameLocks noGrp="1"/>
            </p:cNvGraphicFramePr>
            <p:nvPr>
              <p:extLst>
                <p:ext uri="{{D42A27DB-BD31-4B8C-83A1-F6EECF244321}}">
                  <p14:modId val="3556452996" xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main"/>
                </p:ext>
              </p:extLst>
            </p:nvPr>
          </p:nvGraphicFramePr>
          <p:xfrm>
            <a:off x="4572000" y="3631220"/>
            <a:ext cx="4419601" cy="940780"/>
          </p:xfrm>
          <a:graphic>
            <a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/table">
              <a:tbl>
                <a:tblPr bandRow="1" firstRow="1">
                  <a:tableStyleId>{{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}}</a:tableStyleId>
                </a:tblPr>
                <a:tblGrid>
                  <a:gridCol w="533400"/>
                  <a:gridCol w="685800"/>
                  <a:gridCol w="914400"/>
                  <a:gridCol w="665481"/>
                  <a:gridCol w="589280"/>
                  <a:gridCol w="399869"/>
                  <a:gridCol w="631371"/>
                </a:tblGrid>
                <a:tr h="304800">
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:r>
                          <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1000"/>
                          <a:t>Burn</a:t>
                        </a:r>
                        <a:r>
                          <a:rPr baseline="0" dirty="0" lang="en-US" smtClean="0" sz="1000"/>
                          <a:t>rate</a:t>
                        </a:r>
                        <a:endParaRPr dirty="0" lang="en-US" sz="1000"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr/>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:r>
                          <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1000"/>
                          <a:t>Schedule</a:t>
                        </a:r>
                        <a:endParaRPr dirty="0" lang="en-US" sz="1000"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr/>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:r>
                          <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1000"/>
                          <a:t>Performance</a:t>
                        </a:r>
                        <a:endParaRPr dirty="0" lang="en-US" sz="1000"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr/>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:r>
                          <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1000"/>
                          <a:t>Funding</a:t>
                        </a:r>
                        <a:endParaRPr dirty="0" lang="en-US" sz="1000"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr/>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:r>
                          <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1000"/>
                          <a:t>Sustain</a:t>
                        </a:r>
                        <a:endParaRPr dirty="0" lang="en-US" sz="1000"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr/>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:r>
                          <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1000"/>
                          <a:t>Risk</a:t>
                        </a:r>
                        <a:endParaRPr dirty="0" lang="en-US" sz="1000"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr/>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:r>
                          <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1000"/>
                          <a:t>Issues</a:t>
                        </a:r>
                        <a:endParaRPr dirty="0" lang="en-US" sz="1000"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr/>
                  </a:tc>
                </a:tr>
                <a:tr h="544540">
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:endParaRPr dirty="0" lang="en-US" sz="1000"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr>
                      <a:solidFill>
                        <a:srgbClr val="00B050"/>
                      </a:solidFill>
                    </a:tcPr>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:endParaRPr dirty="0" lang="en-US" sz="1000"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr>
                      <a:solidFill>
                        <a:srgbClr val="FFFF00"/>
                      </a:solidFill>
                    </a:tcPr>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:endParaRPr dirty="0" lang="en-US" sz="1000"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr>
                      <a:solidFill>
                        <a:srgbClr val="FF0000"/>
                      </a:solidFill>
                    </a:tcPr>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:endParaRPr dirty="0" lang="en-US" sz="1000"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr>
                      <a:solidFill>
                        <a:srgbClr val="00B050"/>
                      </a:solidFill>
                    </a:tcPr>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:endParaRPr dirty="0" lang="en-US" sz="1000"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr>
                      <a:solidFill>
                        <a:srgbClr val="FFFF00"/>
                      </a:solidFill>
                    </a:tcPr>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:endParaRPr dirty="0" lang="en-US" sz="1000"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr>
                      <a:solidFill>
                        <a:srgbClr val="FF0000"/>
                      </a:solidFill>
                    </a:tcPr>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:endParaRPr dirty="0" lang="en-US" sz="1000"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr>
                      <a:solidFill>
                        <a:srgbClr val="00B050"/>
                      </a:solidFill>
                    </a:tcPr>
                  </a:tc>
                </a:tr>
              </a:tbl>
            </a:graphicData>
          </a:graphic>
        </p:graphicFrame>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="7" name="last-update"/>
            <p:cNvSpPr txBox="1"/>
            <p:nvPr/>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="7010400" y="136071"/>
              <a:ext cx="1888350" cy="381000"/>
            </a:xfrm>
            <a:prstGeom prst="rect">
              <a:avLst/>
            </a:prstGeom>
            <a:noFill/>
          </p:spPr>
          <p:txBody>
            <a:bodyPr rtlCol="0" wrap="square">
              <a:spAutoFit/>
            </a:bodyPr>
            <a:lstStyle/>
            <a:p>
              <a:r>
                <a:rPr lang="en-US" smtClean="0"/>
                <a:t>{$project/*:component/*:last-update}</a:t>
              </a:r>
              <a:endParaRPr dirty="0" lang="en-US"/>
            </a:p>
          </p:txBody>
        </p:sp>
        <p:cxnSp>
          <p:nvCxnSpPr>
            <p:cNvPr id="10" name="Straight Connector 9"/>
            <p:cNvCxnSpPr/>
            <p:nvPr/>
          </p:nvCxnSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="76200" y="1283732"/>
              <a:ext cx="8915400" cy="11668"/>
            </a:xfrm>
            <a:prstGeom prst="line">
              <a:avLst/>
            </a:prstGeom>
            <a:ln w="28575"/>
          </p:spPr>
          <p:style>
            <a:lnRef idx="1">
              <a:schemeClr val="accent1"/>
            </a:lnRef>
            <a:fillRef idx="0">
              <a:schemeClr val="accent1"/>
            </a:fillRef>
            <a:effectRef idx="0">
              <a:schemeClr val="accent1"/>
            </a:effectRef>
            <a:fontRef idx="minor">
              <a:schemeClr val="tx1"/>
            </a:fontRef>
          </p:style>
        </p:cxnSp>
        <p:grpSp>
          <p:nvGrpSpPr>
            <p:cNvPr id="39" name="Group 38"/>
            <p:cNvGrpSpPr/>
            <p:nvPr/>
          </p:nvGrpSpPr>
          <p:grpSpPr>
            <a:xfrm>
              <a:off x="0" y="914400"/>
              <a:ext cx="8991600" cy="5791200"/>
              <a:chOff x="0" y="914400"/>
              <a:chExt cx="8991600" cy="5791200"/>
            </a:xfrm>
          </p:grpSpPr>
          <p:cxnSp>
            <p:nvCxnSpPr>
              <p:cNvPr id="8" name="Straight Connector 7"/>
              <p:cNvCxnSpPr/>
              <p:nvPr/>
            </p:nvCxnSpPr>
            <p:spPr>
              <a:xfrm>
                <a:off x="76200" y="914400"/>
                <a:ext cx="8915400" cy="0"/>
              </a:xfrm>
              <a:prstGeom prst="line">
                <a:avLst/>
              </a:prstGeom>
              <a:ln w="28575"/>
            </p:spPr>
            <p:style>
              <a:lnRef idx="1">
                <a:schemeClr val="accent1"/>
              </a:lnRef>
              <a:fillRef idx="0">
                <a:schemeClr val="accent1"/>
              </a:fillRef>
              <a:effectRef idx="0">
                <a:schemeClr val="accent1"/>
              </a:effectRef>
              <a:fontRef idx="minor">
                <a:schemeClr val="tx1"/>
              </a:fontRef>
            </p:style>
          </p:cxnSp>
          <p:sp>
            <p:nvSpPr>
              <p:cNvPr id="9" name="requirement"/>
              <p:cNvSpPr txBox="1"/>
              <p:nvPr/>
            </p:nvSpPr>
            <p:spPr>
              <a:xfrm>
                <a:off x="0" y="914400"/>
                <a:ext cx="8991600" cy="369332"/>
              </a:xfrm>
              <a:prstGeom prst="rect">
                <a:avLst/>
              </a:prstGeom>
              <a:noFill/>
            </p:spPr>
            <p:txBody>
              <a:bodyPr rtlCol="0" wrap="square">
                <a:spAutoFit/>
              </a:bodyPr>
              <a:lstStyle/>
              <a:p>
                <a:r>
                  <a:rPr dirty="0" lang="en-US" smtClean="0"/>
                  <a:t>Requirement:</a:t>
                </a:r>
                <a:endParaRPr dirty="0" lang="en-US"/>
              </a:p>
            </p:txBody>
          </p:sp>
          <p:cxnSp>
            <p:nvCxnSpPr>
              <p:cNvPr id="13" name="Straight Connector 12"/>
              <p:cNvCxnSpPr/>
              <p:nvPr/>
            </p:nvCxnSpPr>
            <p:spPr>
              <a:xfrm>
                <a:off x="4495800" y="1295400"/>
                <a:ext cx="0" cy="5410200"/>
              </a:xfrm>
              <a:prstGeom prst="line">
                <a:avLst/>
              </a:prstGeom>
              <a:ln w="28575"/>
            </p:spPr>
            <p:style>
              <a:lnRef idx="1">
                <a:schemeClr val="accent1"/>
              </a:lnRef>
              <a:fillRef idx="0">
                <a:schemeClr val="accent1"/>
              </a:fillRef>
              <a:effectRef idx="0">
                <a:schemeClr val="accent1"/>
              </a:effectRef>
              <a:fontRef idx="minor">
                <a:schemeClr val="tx1"/>
              </a:fontRef>
            </p:style>
          </p:cxnSp>
          <p:cxnSp>
            <p:nvCxnSpPr>
              <p:cNvPr id="15" name="Straight Connector 14"/>
              <p:cNvCxnSpPr/>
              <p:nvPr/>
            </p:nvCxnSpPr>
            <p:spPr>
              <a:xfrm>
                <a:off x="114300" y="3521018"/>
                <a:ext cx="8839200" cy="0"/>
              </a:xfrm>
              <a:prstGeom prst="line">
                <a:avLst/>
              </a:prstGeom>
              <a:ln w="28575"/>
            </p:spPr>
            <p:style>
              <a:lnRef idx="1">
                <a:schemeClr val="accent1"/>
              </a:lnRef>
              <a:fillRef idx="0">
                <a:schemeClr val="accent1"/>
              </a:fillRef>
              <a:effectRef idx="0">
                <a:schemeClr val="accent1"/>
              </a:effectRef>
              <a:fontRef idx="minor">
                <a:schemeClr val="tx1"/>
              </a:fontRef>
            </p:style>
          </p:cxnSp>
        </p:grpSp>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="27" name="description-label"/>
            <p:cNvSpPr txBox="1"/>
            <p:nvPr/>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="4572000" y="1339334"/>
              <a:ext cx="4419600" cy="369332"/>
            </a:xfrm>
            <a:prstGeom prst="rect">
              <a:avLst/>
            </a:prstGeom>
            <a:noFill/>
          </p:spPr>
          <p:txBody>
            <a:bodyPr rtlCol="0" wrap="square">
              <a:spAutoFit/>
            </a:bodyPr>
            <a:lstStyle/>
            <a:p>
              <a:r>
                <a:rPr b="1" dirty="0" lang="en-US" smtClean="0" u="sng"/>
                <a:t>PROJECT DESCRIPTION:</a:t>
              </a:r>
              <a:endParaRPr b="1" dirty="0" lang="en-US" u="sng"/>
            </a:p>
          </p:txBody>
        </p:sp>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="28" name="description"/>
            <p:cNvSpPr txBox="1"/>
            <p:nvPr/>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="4724400" y="1828800"/>
              <a:ext cx="4174350" cy="584775"/>
            </a:xfrm>
            <a:prstGeom prst="rect">
              <a:avLst/>
            </a:prstGeom>
            <a:noFill/>
          </p:spPr>
          <p:txBody>
            <a:bodyPr rtlCol="0" wrap="square">
              <a:spAutoFit/>
            </a:bodyPr>
            <a:lstStyle/>
            <a:p>
              <a:pPr indent="-285750" marL="285750">
                <a:buFont charset="0" pitchFamily="34" typeface="Arial"/>
                <a:buChar char="•"/>
              </a:pPr>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1600"/>
                <a:t>{$project/*:component/*:description/text()}</a:t>
              </a:r>
            </a:p>
            <a:p>
              <a:endParaRPr dirty="0" lang="en-US" sz="1600"/>
            </a:p>
          </p:txBody>
        </p:sp>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="29" name="sponsor"/>
            <p:cNvSpPr txBox="1"/>
            <p:nvPr/>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="76200" y="3826209"/>
              <a:ext cx="4267200" cy="307777"/>
            </a:xfrm>
            <a:prstGeom prst="rect">
              <a:avLst/>
            </a:prstGeom>
            <a:noFill/>
          </p:spPr>
          <p:txBody>
            <a:bodyPr rtlCol="0" wrap="square">
              <a:spAutoFit/>
            </a:bodyPr>
            <a:lstStyle/>
            <a:p>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>SPONSOR: {fn:string-join($project/*:component//*:sponsor/text(),', ')}</a:t>
              </a:r>
              <a:endParaRPr dirty="0" lang="en-US" sz="1400"/>
            </a:p>
          </p:txBody>
        </p:sp>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="30" name="ic-mission-partners"/>
            <p:cNvSpPr txBox="1"/>
            <p:nvPr/>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="76200" y="4599486"/>
              <a:ext cx="4267200" cy="307777"/>
            </a:xfrm>
            <a:prstGeom prst="rect">
              <a:avLst/>
            </a:prstGeom>
            <a:noFill/>
          </p:spPr>
          <p:txBody>
            <a:bodyPr rtlCol="0" wrap="square">
              <a:spAutoFit/>
            </a:bodyPr>
            <a:lstStyle/>
            <a:p>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>IC MISSION PARTNERS: {fn:string-join($project/*:component//*:partner/text(),', ')}</a:t>
              </a:r>
              <a:endParaRPr dirty="0" lang="en-US" sz="1400"/>
            </a:p>
          </p:txBody>
        </p:sp>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="31" name="customer"/>
            <p:cNvSpPr txBox="1"/>
            <p:nvPr/>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="76200" y="4197106"/>
              <a:ext cx="4267200" cy="307777"/>
            </a:xfrm>
            <a:prstGeom prst="rect">
              <a:avLst/>
            </a:prstGeom>
            <a:noFill/>
          </p:spPr>
          <p:txBody>
            <a:bodyPr rtlCol="0" wrap="square">
              <a:spAutoFit/>
            </a:bodyPr>
            <a:lstStyle/>
            <a:p>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>CUSTOMER: {fn:string-join($project/*:component//*:customer/text(),', ')}</a:t>
              </a:r>
              <a:endParaRPr dirty="0" lang="en-US" sz="1400"/>
            </a:p>
          </p:txBody>
        </p:sp>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="32" name="ic-transition-agent"/>
            <p:cNvSpPr txBox="1"/>
            <p:nvPr/>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="76200" y="4957932"/>
              <a:ext cx="4267200" cy="307777"/>
            </a:xfrm>
            <a:prstGeom prst="rect">
              <a:avLst/>
            </a:prstGeom>
            <a:noFill/>
          </p:spPr>
          <p:txBody>
            <a:bodyPr rtlCol="0" wrap="square">
              <a:spAutoFit/>
            </a:bodyPr>
            <a:lstStyle/>
            <a:p>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>TRANSITION AGENT: {fn:string-join($project/*:component//*:transition-agent/text(),', ')}</a:t>
              </a:r>
              <a:endParaRPr dirty="0" lang="en-US" sz="1400"/>
            </a:p>
          </p:txBody>
        </p:sp>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="33" name="contract-name"/>
            <p:cNvSpPr txBox="1"/>
            <p:nvPr/>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="76200" y="5339715"/>
              <a:ext cx="4267200" cy="307777"/>
            </a:xfrm>
            <a:prstGeom prst="rect">
              <a:avLst/>
            </a:prstGeom>
            <a:noFill/>
          </p:spPr>
          <p:txBody>
            <a:bodyPr rtlCol="0" wrap="square">
              <a:spAutoFit/>
            </a:bodyPr>
            <a:lstStyle/>
            <a:p>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>Contract Name:{$project/*:component//*:contract/*:name/text()} </a:t>
              </a:r>
              <a:endParaRPr dirty="0" lang="en-US" sz="1400"/>
            </a:p>
          </p:txBody>
        </p:sp>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="34" name="prime"/>
            <p:cNvSpPr txBox="1"/>
            <p:nvPr/>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="76200" y="5709047"/>
              <a:ext cx="4267200" cy="307777"/>
            </a:xfrm>
            <a:prstGeom prst="rect">
              <a:avLst/>
            </a:prstGeom>
            <a:noFill/>
          </p:spPr>
          <p:txBody>
            <a:bodyPr rtlCol="0" wrap="square">
              <a:spAutoFit/>
            </a:bodyPr>
            <a:lstStyle/>
            <a:p>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>PRIME: {$project/*:component//*:prime/text()}</a:t>
              </a:r>
              <a:endParaRPr dirty="0" lang="en-US" sz="1400"/>
            </a:p>
          </p:txBody>
        </p:sp>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="35" name="interagency-agreement"/>
            <p:cNvSpPr txBox="1"/>
            <p:nvPr/>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="76200" y="6013847"/>
              <a:ext cx="4267200" cy="307777"/>
            </a:xfrm>
            <a:prstGeom prst="rect">
              <a:avLst/>
            </a:prstGeom>
            <a:noFill/>
          </p:spPr>
          <p:txBody>
            <a:bodyPr rtlCol="0" wrap="square">
              <a:spAutoFit/>
            </a:bodyPr>
            <a:lstStyle/>
            <a:p>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>INTERAGENCY AGREEMENT: {$project/*:component//*:interagency-agreement/text()} </a:t>
              </a:r>
              <a:endParaRPr dirty="0" lang="en-US" sz="1400"/>
            </a:p>
          </p:txBody>
        </p:sp>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="36" name="security-classification-guide"/>
            <p:cNvSpPr txBox="1"/>
            <p:nvPr/>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="76200" y="6321623"/>
              <a:ext cx="4267200" cy="307777"/>
            </a:xfrm>
            <a:prstGeom prst="rect">
              <a:avLst/>
            </a:prstGeom>
            <a:noFill/>
          </p:spPr>
          <p:txBody>
            <a:bodyPr rtlCol="0" wrap="square">
              <a:spAutoFit/>
            </a:bodyPr>
            <a:lstStyle/>
            <a:p>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>SECURITY CLASSIFICATION GUIDE: {$project/*:component//*:security-classification-guide/text()} </a:t>
              </a:r>
              <a:endParaRPr dirty="0" lang="en-US" sz="1400"/>
            </a:p>
          </p:txBody>
        </p:sp>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="37" name="project-status-label"/>
            <p:cNvSpPr txBox="1"/>
            <p:nvPr/>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="4533900" y="4773266"/>
              <a:ext cx="3429000" cy="369332"/>
            </a:xfrm>
            <a:prstGeom prst="rect">
              <a:avLst/>
            </a:prstGeom>
            <a:noFill/>
          </p:spPr>
          <p:txBody>
            <a:bodyPr rtlCol="0" wrap="square">
              <a:spAutoFit/>
            </a:bodyPr>
            <a:lstStyle/>
            <a:p>
              <a:r>
                <a:rPr b="1" dirty="0" lang="en-US" smtClean="0" u="sng"/>
                <a:t>PROJECT STATUS</a:t>
              </a:r>
              <a:endParaRPr b="1" dirty="0" lang="en-US" u="sng"/>
            </a:p>
          </p:txBody>
        </p:sp>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="38" name="project-status"/>
            <p:cNvSpPr txBox="1"/>
            <p:nvPr/>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="4572000" y="5096470"/>
              <a:ext cx="3048000" cy="923330"/>
            </a:xfrm>
            <a:prstGeom prst="rect">
              <a:avLst/>
            </a:prstGeom>
            <a:noFill/>
          </p:spPr>
          <p:txBody>
            <a:bodyPr rtlCol="0" wrap="square">
              <a:spAutoFit/>
            </a:bodyPr>
            <a:lstStyle/>
            {
              for $status in $project/*:component/*:status
              return
                <a:p>
                  <a:pPr indent="-285750" marL="285750">
                    <a:buFont charset="0" pitchFamily="34" typeface="Arial"/>
                    <a:buChar char="•"/>
                  </a:pPr>
                  <a:r>
                    <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1100"/>
                    <a:t>{fn:concat(fn:concat(fn:concat('(',fn:data($status/@*:classification)),')'), $status/text())}</a:t>
                  </a:r>
                </a:p>
            }
          </p:txBody>
        </p:sp>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="40" name="funding-type-label"/>
            <p:cNvSpPr txBox="1"/>
            <p:nvPr/>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="4572000" y="6019800"/>
              <a:ext cx="1676400" cy="383977"/>
            </a:xfrm>
            <a:prstGeom prst="rect">
              <a:avLst/>
            </a:prstGeom>
            <a:noFill/>
          </p:spPr>
          <p:txBody>
            <a:bodyPr rtlCol="0" wrap="square">
              <a:spAutoFit/>
            </a:bodyPr>
            <a:lstStyle/>
            <a:p>
              <a:r>
                <a:rPr b="1" dirty="0" lang="en-US" smtClean="0"/>
                <a:t>FUNDING TYPE: </a:t>
              </a:r>
              <a:endParaRPr b="1" dirty="0" lang="en-US"/>
            </a:p>
          </p:txBody>
        </p:sp>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="41" name="funding-type"/>
            <p:cNvSpPr txBox="1"/>
            <p:nvPr/>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="6237514" y="6040866"/>
              <a:ext cx="2628900" cy="369332"/>
            </a:xfrm>
            <a:prstGeom prst="rect">
              <a:avLst/>
            </a:prstGeom>
            <a:noFill/>
          </p:spPr>
          <p:txBody>
            <a:bodyPr rtlCol="0" wrap="square">
              <a:spAutoFit/>
            </a:bodyPr>
            <a:lstStyle/>
            <a:p>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0"/>
                <a:t>(U) FFO: FY14 $2.5 million</a:t>
              </a:r>
              <a:endParaRPr dirty="0" lang="en-US"/>
            </a:p>
          </p:txBody>
        </p:sp>
      </p:spTree>
      <p:extLst>
        <p:ext uri="{{BB962C8B-B14F-4D97-AF65-F5344CB8AC3E}}">
          <p14:creationId val="3520663452" xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main"/>
        </p:ext>
      </p:extLst>
    </p:cSld>
    <p:clrMapOvr>
      <a:masterClrMapping/>
    </p:clrMapOvr>
    <p:timing>
      <p:tnLst>
        <p:par>
          <p:cTn dur="indefinite" id="1" nodeType="tmRoot" restart="never"/>
        </p:par>
      </p:tnLst>
    </p:timing>
  </p:sld>

  (:xdmp:document-insert("/template.pptx/ppt/slides/slide2.xml", $slide, (), "presentationML"):)
return document { $slide }

xquery version "1.0-ml";

declare namespace c = "http://marklogic.com/program360/contract";
declare namespace ism = "urn:us:gov:ic:ism";
declare namespace p = "http://schemas.openxmlformats.org/presentationml/2006/main";
declare namespace a="http://schemas.openxmlformats.org/drawingml/2006/main";
declare namespace r = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
declare namespace sch = "http://marklogic.com/program360/schedule";

declare variable $PROJECT-URI as xs:string external;

let $project := fn:doc($PROJECT-URI)
let $classification := $project/*:component/*:name/@*:classification
let $slide :=
  <p:sld xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
    <p:cSld>
      <p:spTree>
        <p:nvGrpSpPr>
          <p:cNvPr id="1" name=""/>
          <p:cNvGrpSpPr/>
          <p:nvPr/>
        </p:nvGrpSpPr>
        <p:grpSpPr>
          <a:xfrm>
            <a:off x="0" y="0"/>
            <a:ext cx="0" cy="0"/>
            <a:chOff x="0" y="0"/>
            <a:chExt cx="0" cy="0"/>
          </a:xfrm>
        </p:grpSpPr>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="2" name="title"/>
            <p:cNvSpPr>
              <a:spLocks noGrp="1"/>
            </p:cNvSpPr>
            <p:nvPr>
              <p:ph type="ctrTitle"/>
            </p:nvPr>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="990600" y="228600"/>
              <a:ext cx="7772400" cy="614728"/>
            </a:xfrm>
            <a:noFill/>
          </p:spPr>
          <p:txBody>
            <a:bodyPr>
              <a:noAutofit/>
            </a:bodyPr>
            <a:lstStyle/>
            <a:p>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="3600"/>
                <a:t>{fn:concat(fn:concat("(",$classification),") ")} {$project/*:component/*:name/text()}</a:t>
              </a:r>
              <a:endParaRPr dirty="0" lang="en-US" sz="3600"/>
            </a:p>
          </p:txBody>
        </p:sp>
        <p:graphicFrame>
          <p:nvGraphicFramePr>
            <p:cNvPr id="11" name="Table 10"/>
            <p:cNvGraphicFramePr>
              <a:graphicFrameLocks noGrp="1"/>
            </p:cNvGraphicFramePr>
            <p:nvPr>
              <p:extLst>
                <p:ext uri="{{D42A27DB-BD31-4B8C-83A1-F6EECF244321}}">
                  <p14:modId val="3556452996" xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main"/>
                </p:ext>
              </p:extLst>
            </p:nvPr>
          </p:nvGraphicFramePr>
          <p:xfrm>
            <a:off x="4572000" y="3631220"/>
            <a:ext cx="4419601" cy="940780"/>
          </p:xfrm>
          <a:graphic>
            <a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/table">
              <a:tbl>
                <a:tblPr bandRow="1" firstRow="1">
                  <a:tableStyleId>{{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}}</a:tableStyleId>
                </a:tblPr>
                <a:tblGrid>
                  <a:gridCol w="533400"/>
                  <a:gridCol w="685800"/>
                  <a:gridCol w="914400"/>
                  <a:gridCol w="665481"/>
                  <a:gridCol w="589280"/>
                  <a:gridCol w="399869"/>
                  <a:gridCol w="631371"/>
                </a:tblGrid>
                <a:tr h="304800">
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:r>
                          <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1000"/>
                          <a:t>Burn</a:t>
                        </a:r>
                        <a:r>
                          <a:rPr baseline="0" dirty="0" lang="en-US" smtClean="0" sz="1000"/>
                          <a:t>rate</a:t>
                        </a:r>
                        <a:endParaRPr dirty="0" lang="en-US" sz="1000"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr/>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:r>
                          <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1000"/>
                          <a:t>Schedule</a:t>
                        </a:r>
                        <a:endParaRPr dirty="0" lang="en-US" sz="1000"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr/>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:r>
                          <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1000"/>
                          <a:t>Performance</a:t>
                        </a:r>
                        <a:endParaRPr dirty="0" lang="en-US" sz="1000"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr/>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:r>
                          <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1000"/>
                          <a:t>Funding</a:t>
                        </a:r>
                        <a:endParaRPr dirty="0" lang="en-US" sz="1000"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr/>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:r>
                          <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1000"/>
                          <a:t>Sustain</a:t>
                        </a:r>
                        <a:endParaRPr dirty="0" lang="en-US" sz="1000"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr/>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:r>
                          <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1000"/>
                          <a:t>Risk</a:t>
                        </a:r>
                        <a:endParaRPr dirty="0" lang="en-US" sz="1000"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr/>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:r>
                          <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1000"/>
                          <a:t>Issues</a:t>
                        </a:r>
                        <a:endParaRPr dirty="0" lang="en-US" sz="1000"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr/>
                  </a:tc>
                </a:tr>
                <a:tr h="544540">
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:endParaRPr dirty="0" lang="en-US" sz="1000"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr>
                      <a:solidFill>
                        <a:srgbClr val="00B050"/>
                      </a:solidFill>
                    </a:tcPr>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:endParaRPr dirty="0" lang="en-US" sz="1000"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr>
                      <a:solidFill>
                        <a:srgbClr val="FFFF00"/>
                      </a:solidFill>
                    </a:tcPr>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:endParaRPr dirty="0" lang="en-US" sz="1000"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr>
                      <a:solidFill>
                        <a:srgbClr val="FF0000"/>
                      </a:solidFill>
                    </a:tcPr>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:endParaRPr dirty="0" lang="en-US" sz="1000"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr>
                      <a:solidFill>
                        <a:srgbClr val="00B050"/>
                      </a:solidFill>
                    </a:tcPr>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:endParaRPr dirty="0" lang="en-US" sz="1000"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr>
                      <a:solidFill>
                        <a:srgbClr val="FFFF00"/>
                      </a:solidFill>
                    </a:tcPr>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:endParaRPr dirty="0" lang="en-US" sz="1000"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr>
                      <a:solidFill>
                        <a:srgbClr val="FF0000"/>
                      </a:solidFill>
                    </a:tcPr>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:endParaRPr dirty="0" lang="en-US" sz="1000"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr>
                      <a:solidFill>
                        <a:srgbClr val="00B050"/>
                      </a:solidFill>
                    </a:tcPr>
                  </a:tc>
                </a:tr>
              </a:tbl>
            </a:graphicData>
          </a:graphic>
        </p:graphicFrame>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="7" name="last-update"/>
            <p:cNvSpPr txBox="1"/>
            <p:nvPr/>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="7010400" y="136071"/>
              <a:ext cx="1888350" cy="381000"/>
            </a:xfrm>
            <a:prstGeom prst="rect">
              <a:avLst/>
            </a:prstGeom>
            <a:noFill/>
          </p:spPr>
          <p:txBody>
            <a:bodyPr rtlCol="0" wrap="square">
              <a:spAutoFit/>
            </a:bodyPr>
            <a:lstStyle/>
            <a:p>
              <a:r>
                <a:rPr lang="en-US" smtClean="0"/>
                <a:t>{$project/*:component/*:last-update}</a:t>
              </a:r>
              <a:endParaRPr dirty="0" lang="en-US"/>
            </a:p>
          </p:txBody>
        </p:sp>
        <p:cxnSp>
          <p:nvCxnSpPr>
            <p:cNvPr id="10" name="Straight Connector 9"/>
            <p:cNvCxnSpPr/>
            <p:nvPr/>
          </p:nvCxnSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="76200" y="1283732"/>
              <a:ext cx="8915400" cy="11668"/>
            </a:xfrm>
            <a:prstGeom prst="line">
              <a:avLst/>
            </a:prstGeom>
            <a:ln w="28575"/>
          </p:spPr>
          <p:style>
            <a:lnRef idx="1">
              <a:schemeClr val="accent1"/>
            </a:lnRef>
            <a:fillRef idx="0">
              <a:schemeClr val="accent1"/>
            </a:fillRef>
            <a:effectRef idx="0">
              <a:schemeClr val="accent1"/>
            </a:effectRef>
            <a:fontRef idx="minor">
              <a:schemeClr val="tx1"/>
            </a:fontRef>
          </p:style>
        </p:cxnSp>
        <p:grpSp>
          <p:nvGrpSpPr>
            <p:cNvPr id="39" name="Group 38"/>
            <p:cNvGrpSpPr/>
            <p:nvPr/>
          </p:nvGrpSpPr>
          <p:grpSpPr>
            <a:xfrm>
              <a:off x="0" y="914400"/>
              <a:ext cx="8991600" cy="5791200"/>
              <a:chOff x="0" y="914400"/>
              <a:chExt cx="8991600" cy="5791200"/>
            </a:xfrm>
          </p:grpSpPr>
          <p:cxnSp>
            <p:nvCxnSpPr>
              <p:cNvPr id="8" name="Straight Connector 7"/>
              <p:cNvCxnSpPr/>
              <p:nvPr/>
            </p:nvCxnSpPr>
            <p:spPr>
              <a:xfrm>
                <a:off x="76200" y="914400"/>
                <a:ext cx="8915400" cy="0"/>
              </a:xfrm>
              <a:prstGeom prst="line">
                <a:avLst/>
              </a:prstGeom>
              <a:ln w="28575"/>
            </p:spPr>
            <p:style>
              <a:lnRef idx="1">
                <a:schemeClr val="accent1"/>
              </a:lnRef>
              <a:fillRef idx="0">
                <a:schemeClr val="accent1"/>
              </a:fillRef>
              <a:effectRef idx="0">
                <a:schemeClr val="accent1"/>
              </a:effectRef>
              <a:fontRef idx="minor">
                <a:schemeClr val="tx1"/>
              </a:fontRef>
            </p:style>
          </p:cxnSp>
          <p:sp>
            <p:nvSpPr>
              <p:cNvPr id="9" name="requirement"/>
              <p:cNvSpPr txBox="1"/>
              <p:nvPr/>
            </p:nvSpPr>
            <p:spPr>
              <a:xfrm>
                <a:off x="0" y="914400"/>
                <a:ext cx="8991600" cy="369332"/>
              </a:xfrm>
              <a:prstGeom prst="rect">
                <a:avLst/>
              </a:prstGeom>
              <a:noFill/>
            </p:spPr>
            <p:txBody>
              <a:bodyPr rtlCol="0" wrap="square">
                <a:spAutoFit/>
              </a:bodyPr>
              <a:lstStyle/>
              <a:p>
                <a:r>
                  <a:rPr dirty="0" lang="en-US" smtClean="0"/>
                  <a:t>Requirement:</a:t>
                </a:r>
                <a:endParaRPr dirty="0" lang="en-US"/>
              </a:p>
            </p:txBody>
          </p:sp>
          <p:cxnSp>
            <p:nvCxnSpPr>
              <p:cNvPr id="13" name="Straight Connector 12"/>
              <p:cNvCxnSpPr/>
              <p:nvPr/>
            </p:nvCxnSpPr>
            <p:spPr>
              <a:xfrm>
                <a:off x="4495800" y="1295400"/>
                <a:ext cx="0" cy="5410200"/>
              </a:xfrm>
              <a:prstGeom prst="line">
                <a:avLst/>
              </a:prstGeom>
              <a:ln w="28575"/>
            </p:spPr>
            <p:style>
              <a:lnRef idx="1">
                <a:schemeClr val="accent1"/>
              </a:lnRef>
              <a:fillRef idx="0">
                <a:schemeClr val="accent1"/>
              </a:fillRef>
              <a:effectRef idx="0">
                <a:schemeClr val="accent1"/>
              </a:effectRef>
              <a:fontRef idx="minor">
                <a:schemeClr val="tx1"/>
              </a:fontRef>
            </p:style>
          </p:cxnSp>
          <p:cxnSp>
            <p:nvCxnSpPr>
              <p:cNvPr id="15" name="Straight Connector 14"/>
              <p:cNvCxnSpPr/>
              <p:nvPr/>
            </p:nvCxnSpPr>
            <p:spPr>
              <a:xfrm>
                <a:off x="114300" y="3521018"/>
                <a:ext cx="8839200" cy="0"/>
              </a:xfrm>
              <a:prstGeom prst="line">
                <a:avLst/>
              </a:prstGeom>
              <a:ln w="28575"/>
            </p:spPr>
            <p:style>
              <a:lnRef idx="1">
                <a:schemeClr val="accent1"/>
              </a:lnRef>
              <a:fillRef idx="0">
                <a:schemeClr val="accent1"/>
              </a:fillRef>
              <a:effectRef idx="0">
                <a:schemeClr val="accent1"/>
              </a:effectRef>
              <a:fontRef idx="minor">
                <a:schemeClr val="tx1"/>
              </a:fontRef>
            </p:style>
          </p:cxnSp>
        </p:grpSp>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="27" name="description-label"/>
            <p:cNvSpPr txBox="1"/>
            <p:nvPr/>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="4572000" y="1339334"/>
              <a:ext cx="4419600" cy="369332"/>
            </a:xfrm>
            <a:prstGeom prst="rect">
              <a:avLst/>
            </a:prstGeom>
            <a:noFill/>
          </p:spPr>
          <p:txBody>
            <a:bodyPr rtlCol="0" wrap="square">
              <a:spAutoFit/>
            </a:bodyPr>
            <a:lstStyle/>
            <a:p>
              <a:r>
                <a:rPr b="1" dirty="0" lang="en-US" smtClean="0" u="sng"/>
                <a:t>PROJECT DESCRIPTION:</a:t>
              </a:r>
              <a:endParaRPr b="1" dirty="0" lang="en-US" u="sng"/>
            </a:p>
          </p:txBody>
        </p:sp>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="28" name="description"/>
            <p:cNvSpPr txBox="1"/>
            <p:nvPr/>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="4724400" y="1828800"/>
              <a:ext cx="4174350" cy="584775"/>
            </a:xfrm>
            <a:prstGeom prst="rect">
              <a:avLst/>
            </a:prstGeom>
            <a:noFill/>
          </p:spPr>
          <p:txBody>
            <a:bodyPr rtlCol="0" wrap="square">
              <a:spAutoFit/>
            </a:bodyPr>
            <a:lstStyle/>
            <a:p>
              <a:pPr indent="-285750" marL="285750">
                <a:buFont charset="0" pitchFamily="34" typeface="Arial"/>
                <a:buChar char="•"/>
              </a:pPr>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1600"/>
                <a:t>{$project/*:component/*:requirement/text()}</a:t>
              </a:r>
            </a:p>
            <a:p>
              <a:endParaRPr dirty="0" lang="en-US" sz="1600"/>
            </a:p>
          </p:txBody>
        </p:sp>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="29" name="sponsor"/>
            <p:cNvSpPr txBox="1"/>
            <p:nvPr/>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="76200" y="3826209"/>
              <a:ext cx="4267200" cy="307777"/>
            </a:xfrm>
            <a:prstGeom prst="rect">
              <a:avLst/>
            </a:prstGeom>
            <a:noFill/>
          </p:spPr>
          <p:txBody>
            <a:bodyPr rtlCol="0" wrap="square">
              <a:spAutoFit/>
            </a:bodyPr>
            <a:lstStyle/>
            <a:p>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>SPONSOR: {fn:string-join($project/*:component//*:sponsor/text(),', ')}</a:t>
              </a:r>
              <a:endParaRPr dirty="0" lang="en-US" sz="1400"/>
            </a:p>
          </p:txBody>
        </p:sp>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="30" name="ic-mission-partners"/>
            <p:cNvSpPr txBox="1"/>
            <p:nvPr/>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="76200" y="4599486"/>
              <a:ext cx="4267200" cy="307777"/>
            </a:xfrm>
            <a:prstGeom prst="rect">
              <a:avLst/>
            </a:prstGeom>
            <a:noFill/>
          </p:spPr>
          <p:txBody>
            <a:bodyPr rtlCol="0" wrap="square">
              <a:spAutoFit/>
            </a:bodyPr>
            <a:lstStyle/>
            <a:p>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>IC MISSION PARTNERS: {fn:string-join($project/*:component//*:partner/text(),', ')}</a:t>
              </a:r>
              <a:endParaRPr dirty="0" lang="en-US" sz="1400"/>
            </a:p>
          </p:txBody>
        </p:sp>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="31" name="customer"/>
            <p:cNvSpPr txBox="1"/>
            <p:nvPr/>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="76200" y="4197106"/>
              <a:ext cx="4267200" cy="307777"/>
            </a:xfrm>
            <a:prstGeom prst="rect">
              <a:avLst/>
            </a:prstGeom>
            <a:noFill/>
          </p:spPr>
          <p:txBody>
            <a:bodyPr rtlCol="0" wrap="square">
              <a:spAutoFit/>
            </a:bodyPr>
            <a:lstStyle/>
            <a:p>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>CUSTOMER: {fn:string-join($project/*:component//*:customer/text(),', ')}</a:t>
              </a:r>
              <a:endParaRPr dirty="0" lang="en-US" sz="1400"/>
            </a:p>
          </p:txBody>
        </p:sp>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="32" name="ic-transition-agent"/>
            <p:cNvSpPr txBox="1"/>
            <p:nvPr/>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="76200" y="4957932"/>
              <a:ext cx="4267200" cy="307777"/>
            </a:xfrm>
            <a:prstGeom prst="rect">
              <a:avLst/>
            </a:prstGeom>
            <a:noFill/>
          </p:spPr>
          <p:txBody>
            <a:bodyPr rtlCol="0" wrap="square">
              <a:spAutoFit/>
            </a:bodyPr>
            <a:lstStyle/>
            <a:p>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>TRANSITION AGENT: {fn:string-join($project/*:component//*:transition-agent/text(),', ')}</a:t>
              </a:r>
              <a:endParaRPr dirty="0" lang="en-US" sz="1400"/>
            </a:p>
          </p:txBody>
        </p:sp>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="33" name="contract-name"/>
            <p:cNvSpPr txBox="1"/>
            <p:nvPr/>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="76200" y="5339715"/>
              <a:ext cx="4267200" cy="307777"/>
            </a:xfrm>
            <a:prstGeom prst="rect">
              <a:avLst/>
            </a:prstGeom>
            <a:noFill/>
          </p:spPr>
          <p:txBody>
            <a:bodyPr rtlCol="0" wrap="square">
              <a:spAutoFit/>
            </a:bodyPr>
            <a:lstStyle/>
            <a:p>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>Contract Name:{$project/*:component//*:contract/*:name/text()} </a:t>
              </a:r>
              <a:endParaRPr dirty="0" lang="en-US" sz="1400"/>
            </a:p>
          </p:txBody>
        </p:sp>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="34" name="prime"/>
            <p:cNvSpPr txBox="1"/>
            <p:nvPr/>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="76200" y="5709047"/>
              <a:ext cx="4267200" cy="307777"/>
            </a:xfrm>
            <a:prstGeom prst="rect">
              <a:avLst/>
            </a:prstGeom>
            <a:noFill/>
          </p:spPr>
          <p:txBody>
            <a:bodyPr rtlCol="0" wrap="square">
              <a:spAutoFit/>
            </a:bodyPr>
            <a:lstStyle/>
            <a:p>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>PRIME: {$project/*:component//*:prime/text()}</a:t>
              </a:r>
              <a:endParaRPr dirty="0" lang="en-US" sz="1400"/>
            </a:p>
          </p:txBody>
        </p:sp>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="35" name="interagency-agreement"/>
            <p:cNvSpPr txBox="1"/>
            <p:nvPr/>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="76200" y="6013847"/>
              <a:ext cx="4267200" cy="307777"/>
            </a:xfrm>
            <a:prstGeom prst="rect">
              <a:avLst/>
            </a:prstGeom>
            <a:noFill/>
          </p:spPr>
          <p:txBody>
            <a:bodyPr rtlCol="0" wrap="square">
              <a:spAutoFit/>
            </a:bodyPr>
            <a:lstStyle/>
            <a:p>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>INTERAGENCY AGREEMENT: {$project/*:component//*:interagency-agreement/text()} </a:t>
              </a:r>
              <a:endParaRPr dirty="0" lang="en-US" sz="1400"/>
            </a:p>
          </p:txBody>
        </p:sp>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="36" name="security-classification-guide"/>
            <p:cNvSpPr txBox="1"/>
            <p:nvPr/>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="76200" y="6321623"/>
              <a:ext cx="4267200" cy="307777"/>
            </a:xfrm>
            <a:prstGeom prst="rect">
              <a:avLst/>
            </a:prstGeom>
            <a:noFill/>
          </p:spPr>
          <p:txBody>
            <a:bodyPr rtlCol="0" wrap="square">
              <a:spAutoFit/>
            </a:bodyPr>
            <a:lstStyle/>
            <a:p>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>SECURITY CLASSIFICATION GUIDE: {$project/*:component//*:security-classification-guide/text()} </a:t>
              </a:r>
              <a:endParaRPr dirty="0" lang="en-US" sz="1400"/>
            </a:p>
          </p:txBody>
        </p:sp>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="37" name="project-status-label"/>
            <p:cNvSpPr txBox="1"/>
            <p:nvPr/>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="4533900" y="4773266"/>
              <a:ext cx="3429000" cy="369332"/>
            </a:xfrm>
            <a:prstGeom prst="rect">
              <a:avLst/>
            </a:prstGeom>
            <a:noFill/>
          </p:spPr>
          <p:txBody>
            <a:bodyPr rtlCol="0" wrap="square">
              <a:spAutoFit/>
            </a:bodyPr>
            <a:lstStyle/>
            <a:p>
              <a:r>
                <a:rPr b="1" dirty="0" lang="en-US" smtClean="0" u="sng"/>
                <a:t>PROJECT STATUS</a:t>
              </a:r>
              <a:endParaRPr b="1" dirty="0" lang="en-US" u="sng"/>
            </a:p>
          </p:txBody>
        </p:sp>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="38" name="project-status"/>
            <p:cNvSpPr txBox="1"/>
            <p:nvPr/>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="4572000" y="5096470"/>
              <a:ext cx="3048000" cy="923330"/>
            </a:xfrm>
            <a:prstGeom prst="rect">
              <a:avLst/>
            </a:prstGeom>
            <a:noFill/>
          </p:spPr>
          <p:txBody>
            <a:bodyPr rtlCol="0" wrap="square">
              <a:spAutoFit/>
            </a:bodyPr>
            <a:lstStyle/>
            {
              for $status in $project/*:component/*:status
              return
                <a:p>
                  <a:pPr indent="-285750" marL="285750">
                    <a:buFont charset="0" pitchFamily="34" typeface="Arial"/>
                    <a:buChar char="•"/>
                  </a:pPr>
                  <a:r>
                    <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1100"/>
                    <a:t>{fn:concat(fn:concat(fn:concat('(',fn:data($status/@*:classification)),')'), $status/text())}</a:t>
                  </a:r>
                </a:p>
            }
          </p:txBody>
        </p:sp>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="40" name="funding-type-label"/>
            <p:cNvSpPr txBox="1"/>
            <p:nvPr/>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="4572000" y="6019800"/>
              <a:ext cx="1676400" cy="383977"/>
            </a:xfrm>
            <a:prstGeom prst="rect">
              <a:avLst/>
            </a:prstGeom>
            <a:noFill/>
          </p:spPr>
          <p:txBody>
            <a:bodyPr rtlCol="0" wrap="square">
              <a:spAutoFit/>
            </a:bodyPr>
            <a:lstStyle/>
            <a:p>
              <a:r>
                <a:rPr b="1" dirty="0" lang="en-US" smtClean="0"/>
                <a:t>FUNDING TYPE: </a:t>
              </a:r>
              <a:endParaRPr b="1" dirty="0" lang="en-US"/>
            </a:p>
          </p:txBody>
        </p:sp>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="41" name="funding-type"/>
            <p:cNvSpPr txBox="1"/>
            <p:nvPr/>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="6237514" y="6040866"/>
              <a:ext cx="2628900" cy="369332"/>
            </a:xfrm>
            <a:prstGeom prst="rect">
              <a:avLst/>
            </a:prstGeom>
            <a:noFill/>
          </p:spPr>
          <p:txBody>
            <a:bodyPr rtlCol="0" wrap="square">
              <a:spAutoFit/>
            </a:bodyPr>
            <a:lstStyle/>
            <a:p>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0"/>
                <a:t>(U) FFO: FY14 $2.5 million</a:t>
              </a:r>
              <a:endParaRPr dirty="0" lang="en-US"/>
            </a:p>
          </p:txBody>
        </p:sp>
      </p:spTree>
      <p:extLst>
        <p:ext uri="{{BB962C8B-B14F-4D97-AF65-F5344CB8AC3E}}">
          <p14:creationId val="3520663452" xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main"/>
        </p:ext>
      </p:extLst>
    </p:cSld>
    <p:clrMapOvr>
      <a:masterClrMapping/>
    </p:clrMapOvr>
    <p:timing>
      <p:tnLst>
        <p:par>
          <p:cTn dur="indefinite" id="1" nodeType="tmRoot" restart="never"/>
        </p:par>
      </p:tnLst>
    </p:timing>
  </p:sld>

  (:xdmp:document-insert("/template.pptx/ppt/slides/slide2.xml", $slide, (), "presentationML"):)
return document { $slide }


fixing bug: separating validation of form from conceptual domain selection and enabling maintenance links

xquery version "1.0";

(: ~
 : Module Name:             new value domain webpage and XQuery
 :
 : Module Version           2.0
 :
 : Date                     31st July 2009
 :
 : Copyright                The cagrid consortium
 :
 : Module overview          Creates and value domain and displays list
 :
 :)

(:~
 :    @author Rakesh Dhaval
      @author Puneet Mathur
 :    @version 0.1
~ :)

  import module namespace
  lib-forms="http://www.cagrid.org/xquery/library/forms"
  at "../edit/m-lib-forms.xquery";

  import module namespace
  lib-util="http://www.cagrid.org/xquery/library/util"
  at "../library/m-lib-util.xquery";

  import module namespace
  lib-rendering="http://www.cagrid.org/xquery/library/rendering"
  at "../web/m-lib-rendering.xquery";

  import module namespace
    lib-make-admin-item="http://www.cagrid.org/xquery/library/make-admin-item"
    at "../edit/m-lib-make-admin-item.xquery";

  import module namespace
   administered-item="http://www.cagrid.org/xquery/library/administered-item"
   at "../library/m-administered-item.xquery";

declare namespace openMDR = "http://www.cagrid.org/schema/openMDR";
declare namespace ISO11179= "http://www.cagrid.org/schema/ISO11179";
declare namespace session="http://exist-db.org/xquery/session";
declare namespace request="http://exist-db.org/xquery/request";
declare namespace response="http://exist-db.org/xquery/response";
declare namespace exist = "http://exist.sourceforge.net/NS/exist";
declare namespace util="http://exist-db.org/xquery/util";

declare function local:value_domain(
   $reg-auth as xs:string,
   $administrative-note as xs:string,
   $administrative-status as xs:string,
   $administered-by as xs:string,
   $submitted-by as xs:string,
   $registered-by as xs:string,
   $context-ids as xs:string*,
   $country-identifiers as xs:string*,
   $language-identifiers as xs:string*,
   $names as xs:string*,
   $definitions as xs:string*,
   $sources as xs:string*,
   $preferred as xs:string?,
   $conceptual_domain_id as xs:string?,
   $enum_datatype as xs:string?,
   $enum_uom as xs:string?,
   $char_quantity as xs:string?,
   $value_domain_format as xs:string?,
   $values as xs:string*
   ) as xs:boolean
{
   let $version := '0.1'
   let $data-identifier := lib-forms:generate-id()
   let $new-identifier := concat($reg-auth, '_', $data-identifier, '_', $version)
   let $doc-name := concat($new-identifier,'.xml')
   let $concept_domain := lib-util:mdrElement("conceptual_domain",$conceptual_domain_id)
   let $value_meaning-identifier  := data($concept_domain//openMDR:value_meaning_identifier)

   let $content := (
            lib-make-admin-item:administration-record($administrative-note,$administrative-status,'Recorded'),
            lib-make-admin-item:custodians($administered-by,$registered-by,$submitted-by),
            lib-make-admin-item:havings(
                    $context-ids,
                    $country-identifiers,
                    $language-identifiers,
                    $names,
                    $definitions,
                    $preferred,
                    $sources),

             for $meaning at $pos in $concept_domain//openMDR:value_meaning_description
                    return (
                       element openMDR:containing {
                         attribute permissible_value_identifier {lib-forms:generate-id()},
                         element openMDR:permissible_value_begin_date {current-date()},
                         element openMDR:value_item {$values[$pos]},
                         element openMDR:contained_in {$value_meaning-identifier[$pos]}
                       }
             ),
            element openMDR:representing {$conceptual_domain_id},
            element openMDR:value_domain_datatype {$enum_datatype},
            element openMDR:value_domain_unit_of_measure {$enum_uom},
            element openMDR:value_domain_maximum_character_quantity{$char_quantity},
            element openMDR:value_domain_format{$value_domain_format}
    )

   (: compose the document :)
   let $document := (
     if($values > '' ) then (
      element openMDR:Enumerated_Value_Domain {
            attribute item_registration_authority_identifier {$reg-auth},
            attribute data_identifier {$data-identifier},
            attribute version {$version},
            $content
           }
      ) else (
       element openMDR:Non_Enumerated_Value_Domain {
            attribute item_registration_authority_identifier {$reg-auth},
            attribute data_identifier {$data-identifier},
            attribute version {$version},
            $content
           }
      )
   )

   let $collection := 'value_domain'
   let $message := lib-forms:store-document($document)
   return
      if ($message='stored')
      then true()
      else response:redirect-to(xs:anyURI(concat("../web/login.xquery?calling_page=newValueDomain.xquery&",$message)))
};

declare function local:input-page(
   $message as xs:string?,
   $reg-auth as xs:string?,
   $administrative-note  as xs:string?,
   $administrative-status  as xs:string?,
   $administered-by  as xs:string?,
   $submitted-by  as xs:string?,
   $registered-by  as xs:string?,
   $context-ids  as xs:string*,
   $country-identifiers as xs:string*,
   $language-identifiers as xs:string*,
   $names as xs:string*,
   $definitions as xs:string*,
   $sources as xs:string*,
   $action as xs:string?,
   $preferred as xs:string?,
   $conceptual_domain_id as xs:string?,
   $enum_datatype as xs:string?,
   $enum_uom as xs:string?,
   $char_quantity as xs:string?,
   $value_domain_format as xs:string?,
   $values as xs:string*
   ) {
   let $skip-name := substring-after($action,'delete naming entry')
   let $skip-name-index := if ($skip-name>'') then xs:int($skip-name) else 0

   return

                This form will allow you to create a new value domain in the metadata repository

          <form name="new_value_domain" action="newValueDomain.xquery" method="post" class="cagridForm" enctype="multipart/form-data">

           {lib-forms:edit-admin-item($reg-auth,
                     $administrative-note,
                     $administrative-status,
                     $administered-by,
                     $submitted-by,
                     $registered-by,
                     $context-ids,
                     $country-identifiers,
                     $language-identifiers,
                     $names,
                     $definitions,
                     $sources,
                     $preferred,
                     $action)}

Conceptual Domain

                        {
                            let $concept_domain := lib-util:mdrElement("conceptual_domain",$conceptual_domain_id)
                            return

                            if ($conceptual_domain_id > '' or $conceptual_domain_id eq "Cancel") then (

                                    Conceptual Domain ID
                                    {$conceptual_domain_id}
                                    {session:set-attribute("old_cd_id", $conceptual_domain_id)}
                                    {lib-forms:popup-form-search('conceptual_domain','conceptual_domain_id','new_value_domain', 'Change Relationship')}
                                    {lib-forms:hidden-element('conceptual_domain_id',$conceptual_domain_id)}

,

                                    Conceptual Domain Name
                                    {administered-item:preferred-name('conceptual_domain',$conceptual_domain_id)}

,

Value Domain
,

                                   Value Domain Data Type
                                   {lib-forms:make-select-datatype('enum_datatype', request:get-parameter('enum_datatype',''))}

,

                                   Value Domain Unit of Measure
                                   {lib-forms:make-select-uom('enum_uom',request:get-parameter('uom',''))}

,

                                   Value Domain Format (E.g. MM-DD-YYYY)
                                   <input type="text" name="value_domain_format"></input>

,

                                   Value Domain Maximum Character Count
                                   <input type="text" name="char_quantity"></input>

,

                               if($concept_domain//openMDR:value_meaning_description > '')
                               then
                               (

                                        Possible Values	meaning	value

,
                                        for $meaning at $pos in $concept_domain//openMDR:value_meaning_description
                                        return (

                                              Permissable Value {$pos}
                                              {$meaning}
                                              {lib-forms:input-element('values', 20, $values[$pos])}

                                        )
                               ) else ()
                            )
                            else (

                                    Choose Conceptual Domain
                                    {lib-forms:make-select-form-admin-item('conceptual_domain','conceptual_domain_id',$conceptual_domain_id,'new_value_domain', 'Select Relationship')}

                            )
                        }

                                Store

                                <input type="submit" name="update" value="Store" onClick="return validate_adminItems ()"/>
                                <input type="button" name="update" value="Clear" onClick="this.form.reset()"/>

          </form>

{$message}

   };

declare function local:success-page()
{
   let $calling-page := request:get-parameter("calling-page","")
   return

Value Domain class created

Return to maintenance menu

Create another value domain

};

declare option exist:serialize "media-type=text/html method=xhtml doctype-public=-//W3C//DTD XHTML 1.0 Transitional//EN doctype-system=http://www.w3.org/TR/2002/REC-xhtml1-20020801/DTD/xhtml1-transitional.dtd";

   session:create(),
   let $title as xs:string := "Creating a New Value Domain"
   let $reg-auth := request:get-parameter('registration-authority','')
   let $administrative-note := request:get-parameter('administrative-note','')
   let $administrative-status := request:get-parameter('administrative-status','')
   let $administered-by := request:get-parameter('administered-by','')
   let $submitted-by := request:get-parameter('submitted-by','')

   let $registered-by := request:get-parameter('registered-by','')
   let $context-ids := request:get-parameter('context-ids',())
   let $country-identifiers := request:get-parameter('country-identifiers',())
   let $language-identifiers := request:get-parameter('language-identifiers',())
   let $names := request:get-parameter('names',())
   let $definitions := request:get-parameter('definitions',())
   let $sources := request:get-parameter('sources',())
   let $preferred := request:get-parameter('preferred','')
   let $action := request:get-parameter('update','')
   let $conceptual_domain_id as xs:string? := request:get-parameter('conceptual_domain_id','')
   let $values := request:get-parameter('values',())
   let $enum_datatype := request:get-parameter('enum_datatype','')
   let $enum_uom := request:get-parameter('enum_uom','')
   let $char_quantity := request:get-parameter('char_quantity','')
   let $value_domain_format := request:get-parameter('value_domain_format','')

   return
      lib-rendering:txfrm-webpage(
      $title,
      if ($action='Store')
      then
         (
         if (
               local:value_domain
                  (
                     $reg-auth,
                     $administrative-note,
                     $administrative-status,
                     $administered-by,
                     $submitted-by,
                     $registered-by,
                     $context-ids,
                     $country-identifiers,
                     $language-identifiers,
                     $names,
                     $definitions,
                     $sources,
                     $preferred,
                     $conceptual_domain_id,
                     $enum_datatype,
                     $enum_uom,
                     $char_quantity,
                     $value_domain_format,
                     $values
                  )
            )
         then local:success-page()
         else (local:input-page(
            'could not store document',
                     $reg-auth,
                     $administrative-note,
                     $administrative-status,
                     $administered-by,
                     $submitted-by,
                     $registered-by,
                     $context-ids,
                     $country-identifiers,
                     $language-identifiers,
                     $names,
                     $definitions,
                     $sources,
                     $action,
                     $preferred,
                     $conceptual_domain_id,
                     $enum_datatype,
                     $enum_uom,
                     $char_quantity,
                     $value_domain_format,
                     $values
                  )
               )
         )
      else if ($action='Change Relationship')
      then(

            let $conceptual_domain_id as xs:string? := ""
            return local:input-page
               (
               '',
               $reg-auth,
               $administrative-note,
               $administrative-status,
               $administered-by,
               $submitted-by,
               $registered-by,
               $context-ids,
               $country-identifiers,
               $language-identifiers,
               $names,
               $definitions,
               $sources,
               $action,
               $preferred,
               $conceptual_domain_id,
               $enum_datatype,
               $enum_uom,
               $char_quantity,
               $value_domain_format,
               $values
               )
         )
         else if($conceptual_domain_id eq "Cancel")
         then(
               local:input-page
               (
               '',
               $reg-auth,
               $administrative-note,
               $administrative-status,
               $administered-by,
               $submitted-by,
               $registered-by,
               $context-ids,
               $country-identifiers,
               $language-identifiers,
               $names,
               $definitions,
               $sources,
               $action,
               $preferred,
               session:get-attribute("old_cd_id"),
               $enum_datatype,
               $enum_uom,
               $char_quantity,
               $value_domain_format,
               $values
               ),
               session:set-attribute("old_cd_id", "")

          ) else(
          local:input-page
               (
               '',
               $reg-auth,
               $administrative-note,
               $administrative-status,
               $administered-by,
               $submitted-by,
               $registered-by,
               $context-ids,
               $country-identifiers,
               $language-identifiers,
               $names,
               $definitions,
               $sources,
               $action,
               $preferred,
               $conceptual_domain_id,
               $enum_datatype,
               $enum_uom,
               $char_quantity,
               $value_domain_format,
               $values
               )
          )

     )

xquery version "1.0";

(: ~
 : Module Name:             new value domain webpage and XQuery
 :
 : Module Version           2.0
 :
 : Date                     31st July 2009
 :
 : Copyright                The cagrid consortium
 :
 : Module overview          Creates and value domain and displays list
 :
 :)

(:~
 :    @author Rakesh Dhaval
      @author Puneet Mathur
 :    @version 0.1
~ :)

  import module namespace
  lib-forms="http://www.cagrid.org/xquery/library/forms"
  at "../edit/m-lib-forms.xquery";

  import module namespace
  lib-util="http://www.cagrid.org/xquery/library/util"
  at "../library/m-lib-util.xquery";

  import module namespace
  lib-rendering="http://www.cagrid.org/xquery/library/rendering"
  at "../web/m-lib-rendering.xquery";

  import module namespace
    lib-make-admin-item="http://www.cagrid.org/xquery/library/make-admin-item"
    at "../edit/m-lib-make-admin-item.xquery";

  import module namespace
   administered-item="http://www.cagrid.org/xquery/library/administered-item"
   at "../library/m-administered-item.xquery";

declare namespace openMDR = "http://www.cagrid.org/schema/openMDR";
declare namespace ISO11179= "http://www.cagrid.org/schema/ISO11179";
declare namespace session="http://exist-db.org/xquery/session";
declare namespace request="http://exist-db.org/xquery/request";
declare namespace response="http://exist-db.org/xquery/response";
declare namespace exist = "http://exist.sourceforge.net/NS/exist";
declare namespace util="http://exist-db.org/xquery/util";

declare function local:value_domain(
   $reg-auth as xs:string,
   $administrative-note as xs:string,
   $administrative-status as xs:string,
   $administered-by as xs:string,
   $submitted-by as xs:string,
   $registered-by as xs:string,
   $context-ids as xs:string*,
   $country-identifiers as xs:string*,
   $language-identifiers as xs:string*,
   $names as xs:string*,
   $definitions as xs:string*,
   $sources as xs:string*,
   $preferred as xs:string?,
   $conceptual_domain_id as xs:string?,
   $enum_datatype as xs:string?,
   $enum_uom as xs:string?,
   $char_quantity as xs:string?,
   $value_domain_format as xs:string?,
   $values as xs:string*
   ) as xs:boolean
{
   let $version := '0.1'
   let $data-identifier := lib-forms:generate-id()
   let $new-identifier := concat($reg-auth, '_', $data-identifier, '_', $version)
   let $doc-name := concat($new-identifier,'.xml')
   let $concept_domain := lib-util:mdrElement("conceptual_domain",$conceptual_domain_id)
   let $value_meaning-identifier  := data($concept_domain//openMDR:value_meaning_identifier)

   let $content := (
            lib-make-admin-item:administration-record($administrative-note,$administrative-status,'Recorded'),
            lib-make-admin-item:custodians($administered-by,$registered-by,$submitted-by),
            lib-make-admin-item:havings(
                    $context-ids,
                    $country-identifiers,
                    $language-identifiers,
                    $names,
                    $definitions,
                    $preferred,
                    $sources),

             for $meaning at $pos in $concept_domain//openMDR:value_meaning_description
                    return (
                       element openMDR:containing {
                         attribute permissible_value_identifier {lib-forms:generate-id()},
                         element openMDR:permissible_value_begin_date {current-date()},
                         element openMDR:value_item {$values[$pos]},
                         element openMDR:contained_in {$value_meaning-identifier[$pos]}
                       }
             ),
            element openMDR:representing {$conceptual_domain_id},
            element openMDR:value_domain_datatype {$enum_datatype},
            element openMDR:value_domain_unit_of_measure {$enum_uom},
            element openMDR:value_domain_maximum_character_quantity{$char_quantity},
            element openMDR:value_domain_format{$value_domain_format}
    )

   (: compose the document :)
   let $document := (
     if($values > '' ) then (
      element openMDR:Enumerated_Value_Domain {
            attribute item_registration_authority_identifier {$reg-auth},
            attribute data_identifier {$data-identifier},
            attribute version {$version},
            $content
           }
      ) else (
       element openMDR:Non_Enumerated_Value_Domain {
            attribute item_registration_authority_identifier {$reg-auth},
            attribute data_identifier {$data-identifier},
            attribute version {$version},
            $content
           }
      )
   )

   let $collection := 'value_domain'
   let $message := lib-forms:store-document($document)
   return
      if ($message='stored')
      then true()
      else response:redirect-to(xs:anyURI(concat("../web/login.xquery?calling_page=newValueDomain.xquery&",$message)))
};

declare function local:input-page(
   $message as xs:string?,
   $reg-auth as xs:string?,
   $administrative-note  as xs:string?,
   $administrative-status  as xs:string?,
   $administered-by  as xs:string?,
   $submitted-by  as xs:string?,
   $registered-by  as xs:string?,
   $context-ids  as xs:string*,
   $country-identifiers as xs:string*,
   $language-identifiers as xs:string*,
   $names as xs:string*,
   $definitions as xs:string*,
   $sources as xs:string*,
   $action as xs:string?,
   $preferred as xs:string?,
   $conceptual_domain_id as xs:string?,
   $enum_datatype as xs:string?,
   $enum_uom as xs:string?,
   $char_quantity as xs:string?,
   $value_domain_format as xs:string?,
   $values as xs:string*
   ) {
   let $skip-name := substring-after($action,'delete naming entry')
   let $skip-name-index := if ($skip-name>'') then xs:int($skip-name) else 0

   return

                This form will allow you to create a new value domain in the metadata repository

          <form name="new_value_domain" action="newValueDomain.xquery" method="post" class="cagridForm" enctype="multipart/form-data" onSubmit="return validate_adminItems ()">

           {lib-forms:edit-admin-item($reg-auth,
                     $administrative-note,
                     $administrative-status,
                     $administered-by,
                     $submitted-by,
                     $registered-by,
                     $context-ids,
                     $country-identifiers,
                     $language-identifiers,
                     $names,
                     $definitions,
                     $sources,
                     $preferred,
                     $action)}

Conceptual Domain

                        {
                            let $concept_domain := lib-util:mdrElement("conceptual_domain",$conceptual_domain_id)
                            return

                            if ($conceptual_domain_id > '' or $conceptual_domain_id eq "Cancel") then (

                                    Conceptual Domain ID
                                    {$conceptual_domain_id}
                                    {session:set-attribute("old_cd_id", $conceptual_domain_id)}
                                    {lib-forms:popup-form-search('conceptual_domain','conceptual_domain_id','new_value_domain', 'Change Relationship')}
                                    {lib-forms:hidden-element('conceptual_domain_id',$conceptual_domain_id)}

,

                                    Conceptual Domain Name
                                    {administered-item:preferred-name('conceptual_domain',$conceptual_domain_id)}

,

Value Domain
,

                                   Value Domain Data Type
                                   {lib-forms:make-select-datatype('enum_datatype', request:get-parameter('enum_datatype',''))}

,

                                   Value Domain Unit of Measure
                                   {lib-forms:make-select-uom('enum_uom',request:get-parameter('uom',''))}

,

                                   Value Domain Format (E.g. MM-DD-YYYY)
                                   <input type="text" name="value_domain_format"></input>

,

                                   Value Domain Maximum Character Count
                                   <input type="text" name="char_quantity"></input>

,

                               if($concept_domain//openMDR:value_meaning_description > '')
                               then
                               (

                                        Possible Values	meaning	value

,
                                        for $meaning at $pos in $concept_domain//openMDR:value_meaning_description
                                        return (

                                              Permissable Value {$pos}
                                              {$meaning}
                                              {lib-forms:input-element('values', 20, $values[$pos])}

                                        )
                               ) else ()
                            )
                            else (

                                    Choose Conceptual Domain
                                    {lib-forms:make-select-form-admin-item('conceptual_domain','conceptual_domain_id',$conceptual_domain_id,'new_value_domain', 'Select Relationship')}

                            )
                        }

                                Store

                                <input type="submit" name="update" value="Store"/>
                                <input type="button" name="update" value="Clear" onClick="this.form.reset()"/>

          </form>

{$message}

   };

declare function local:success-page()
{
   let $calling-page := request:get-parameter("calling-page","")
   return

Value Domain class created

Return to maintenance menu

Create another value domain

};

declare option exist:serialize "media-type=text/html method=xhtml doctype-public=-//W3C//DTD XHTML 1.0 Transitional//EN doctype-system=http://www.w3.org/TR/2002/REC-xhtml1-20020801/DTD/xhtml1-transitional.dtd";

   session:create(),
   let $title as xs:string := "Creating a New Value Domain"
   let $reg-auth := request:get-parameter('registration-authority','')
   let $administrative-note := request:get-parameter('administrative-note','')
   let $administrative-status := request:get-parameter('administrative-status','')
   let $administered-by := request:get-parameter('administered-by','')
   let $submitted-by := request:get-parameter('submitted-by','')

   let $registered-by := request:get-parameter('registered-by','')
   let $context-ids := request:get-parameter('context-ids',())
   let $country-identifiers := request:get-parameter('country-identifiers',())
   let $language-identifiers := request:get-parameter('language-identifiers',())
   let $names := request:get-parameter('names',())
   let $definitions := request:get-parameter('definitions',())
   let $sources := request:get-parameter('sources',())
   let $preferred := request:get-parameter('preferred','')
   let $action := request:get-parameter('update','')
   let $conceptual_domain_id as xs:string? := request:get-parameter('conceptual_domain_id','')
   let $values := request:get-parameter('values',())
   let $enum_datatype := request:get-parameter('enum_datatype','')
   let $enum_uom := request:get-parameter('enum_uom','')
   let $char_quantity := request:get-parameter('char_quantity','')
   let $value_domain_format := request:get-parameter('value_domain_format','')
   (: let $log := util:log-system-err($values) :)

   return
      lib-rendering:txfrm-webpage(
      $title,
      if ($action='Store')
      then
         (
         if (
               local:value_domain
                  (
                     $reg-auth,
                     $administrative-note,
                     $administrative-status,
                     $administered-by,
                     $submitted-by,
                     $registered-by,
                     $context-ids,
                     $country-identifiers,
                     $language-identifiers,
                     $names,
                     $definitions,
                     $sources,
                     $preferred,
                     $conceptual_domain_id,
                     $enum_datatype,
                     $enum_uom,
                     $char_quantity,
                     $value_domain_format,
                     $values
                  )
            )
         then local:success-page()
         else (local:input-page(
            'could not store document',
                     $reg-auth,
                     $administrative-note,
                     $administrative-status,
                     $administered-by,
                     $submitted-by,
                     $registered-by,
                     $context-ids,
                     $country-identifiers,
                     $language-identifiers,
                     $names,
                     $definitions,
                     $sources,
                     $action,
                     $preferred,
                     $conceptual_domain_id,
                     $enum_datatype,
                     $enum_uom,
                     $char_quantity,
                     $value_domain_format,
                     $values
                  )
               )
         )
      else if ($action='Change Relationship')
      then(

            let $conceptual_domain_id as xs:string? := ""
            return local:input-page
               (
               '',
               $reg-auth,
               $administrative-note,
               $administrative-status,
               $administered-by,
               $submitted-by,
               $registered-by,
               $context-ids,
               $country-identifiers,
               $language-identifiers,
               $names,
               $definitions,
               $sources,
               $action,
               $preferred,
               $conceptual_domain_id,
               $enum_datatype,
               $enum_uom,
               $char_quantity,
               $value_domain_format,
               $values
               )
         )
         else if($conceptual_domain_id eq "Cancel")
         then(
               local:input-page
               (
               '',
               $reg-auth,
               $administrative-note,
               $administrative-status,
               $administered-by,
               $submitted-by,
               $registered-by,
               $context-ids,
               $country-identifiers,
               $language-identifiers,
               $names,
               $definitions,
               $sources,
               $action,
               $preferred,
               session:get-attribute("old_cd_id"),
               $enum_datatype,
               $enum_uom,
               $char_quantity,
               $value_domain_format,
               $values
               ),
               session:set-attribute("old_cd_id", "")

          ) else(
          local:input-page
               (
               '',
               $reg-auth,
               $administrative-note,
               $administrative-status,
               $administered-by,
               $submitted-by,
               $registered-by,
               $context-ids,
               $country-identifiers,
               $language-identifiers,
               $names,
               $definitions,
               $sources,
               $action,
               $preferred,
               $conceptual_domain_id,
               $enum_datatype,
               $enum_uom,
               $char_quantity,
               $value_domain_format,
               $values
               )
          )

     )