<?xml version="1.0" encoding="UTF-8"?>
<!-- N.B this is not yet complete....
 note for completely general version need to change the cea prefixes as well -->
<xsl:stylesheet  
                xmlns:vg="http://www.ivoa.net/xml/VORegistry/v1.0" 
                xmlns:vr="http://www.ivoa.net/xml/VOResource/v1.0" 
                xmlns:vs="http://www.ivoa.net/xml/VODataService/v1.0" 
                xmlns:cea="http://www.ivoa.net/xml/CEA/v1.0" 
                xmlns:ceab="http://www.ivoa.net/xml/CEA/base/v1.0"               
                xmlns:vg.old="http://www.ivoa.net/xml/VORegistry/v0.3" 
                xmlns:vr.old="http://www.ivoa.net/xml/VOResource/v0.10" 
                xmlns:vs.old="http://www.ivoa.net/xml/VODataService/v0.5" 
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
                xmlns:xs="http://www.w3.org/2001/XMLSchema" 
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
   xmlns:rs="http://www.ivoa.org/xml/ResourceSet/v1.0"
   xmlns:impl="http://www.astrogrid.org/schema/CEAImplementation/v1.0"
                exclude-result-prefixes="vr.old  vg.old vs.old" 
                version="1.0 $Revision: 1.4 $">
   <!--   
     -  Stylesheet to convert CEA to CEA 1.0
     $ID:$
     
    -->
   <xsl:output method="xml" encoding="UTF-8" indent="yes" /><xsl:strip-space elements="*"/>

   <!--
     -  The prefix to prepend to schema files listed in the xsi:schemaLocation
     -  (if used).  The value should include a trailing slash as necessary.
     -  The default is an empty string, which indicates the current working 
     -  directory (where output is used).  Note that the xsi:schemaLocation 
     -  is only set if it is set on the input.
     -->
   <xsl:param name="schemaLocationPrefix"/>

   <!--
     -  Set to 1 if the xsi:schemaLocation should be set or zero if it should
     -  not be.  If not set at all (default), xsi:schemaLocation is only set 
     -  if it is set on the input.
     -->
   <xsl:param name="setSchemaLocation"/>

   <xsl:variable name="setSL">
      <xsl:choose>
         <xsl:when test="$setSchemaLocation=''">
            <xsl:choose>
               <xsl:when test="/*/@xsi:schemaLocation">
                  <xsl:copy-of select="1"/>
               </xsl:when>
               <xsl:otherwise><xsl:copy-of select="0"/></xsl:otherwise>
            </xsl:choose>
         </xsl:when>
         <xsl:otherwise>
            <xsl:copy-of select="number($setSchemaLocation)"/>
         </xsl:otherwise>
      </xsl:choose>
   </xsl:variable>

   <xsl:variable name="cr"><xsl:text>
</xsl:text></xsl:variable>



   <xsl:template match="ceab:ParameterDefinition"><!-- check this in original -->
       <xsl:element name="ceab:parameterDefinition">
         <xsl:apply-templates select="@* | node()"/>
      </xsl:element>
     
   </xsl:template>
   <xsl:template match="Interfaces"><!-- check this in original -->
       <xsl:element name="interfaces" namespace="">
         <xsl:apply-templates select="@* | node()"/>
      </xsl:element>
   </xsl:template>
   <xsl:template match="DefaultValue"><!-- check this in original -->
       <xsl:element name="defaultValue" namespace="">
         <xsl:apply-templates select="@* | node()"/>
      </xsl:element>
   </xsl:template>
      <xsl:template match="OptionList"><!-- check this in original -->
       <xsl:element name="optionList" namespace="">
         <xsl:apply-templates/>
      </xsl:element>
   </xsl:template>
      <xsl:template match="OptionVal"><!-- check this in original -->
       <xsl:element name="optionVal" namespace="">
         <xsl:apply-templates/>
      </xsl:element>
   </xsl:template>

   <xsl:template match="Interface"><!-- check this in original -->
       <xsl:element name="interfaceDefinition" namespace="">
         <xsl:apply-templates select="@* | node()"/>
      </xsl:element>
     
   </xsl:template>
   <xsl:template match="Interface/@name">
      <xsl:attribute name="id" >
         <xsl:value-of select="."/>
      </xsl:attribute>
   </xsl:template>
   <xsl:template match="Parameters"><!-- check this in original -->
       <xsl:element name="parameters" namespace="">
         <xsl:apply-templates/>
      </xsl:element>
     
   </xsl:template>

   <xsl:template match="ceab:ParameterDefinition/@name">
      <xsl:attribute name="id" >
         <xsl:value-of select="."/>
      </xsl:attribute>
   </xsl:template>
   <xsl:template match="ceab:ParameterDefinition/UI_Name">
      <xsl:element name="name" namespace="">
         <xsl:apply-templates/>
      </xsl:element>
   </xsl:template>
   <xsl:template match="ceab:ParameterDefinition/UI_Description">
      <xsl:element name="description" namespace="">
         <xsl:apply-templates/>
      </xsl:element>
   </xsl:template>
   <xsl:template match="ceab:ParameterDefinition/UCD">
      <xsl:element name="ucd" namespace="">
         <xsl:apply-templates/>
      </xsl:element>
   </xsl:template>
   <xsl:template match="@minoccurs">
      <xsl:attribute name="minOccurs" >
        <xsl:value-of select="."></xsl:value-of>
    
      </xsl:attribute>
   </xsl:template>
   <xsl:template match="@maxoccurs">
      <xsl:attribute name="maxOccurs">
        <xsl:value-of select="."></xsl:value-of>
    
      </xsl:attribute>
   </xsl:template>
   
   <!-- here are impl specific changes -->
      <xsl:template match="ExecutionPath"><!-- check this in original -->
       <xsl:element name="executionPath" namespace="">
         <xsl:apply-templates select="@* | node()"/>
      </xsl:element>
    </xsl:template>
      <xsl:template match="impl:CmdLineParameterDefn"><!-- check this in original -->
       <xsl:element name="cmdLineParameterDefn" namespace="">
         <xsl:apply-templates select="@* | node()"/>
      </xsl:element>
    </xsl:template>
      <xsl:template match="impl:LongName"><!-- check this in original -->
       <xsl:element name="longName" namespace="">
         <xsl:apply-templates select="@* | node()"/>
      </xsl:element>
    </xsl:template>
     <xsl:template match="impl:CommandLineExecutionControllerConfig"><!-- check this in original -->
       <xsl:element name="commandLineExecutionControllerConfig" namespace="">
         <xsl:apply-templates select="@* | node()"/>
      </xsl:element>
    </xsl:template>
     <xsl:template match="impl:Application"><!-- check this in original -->
       <xsl:element name="application" namespace="">
         <xsl:apply-templates select="@* | node()"/>
      </xsl:element>
    </xsl:template>
     <xsl:template match="impl:referenceURL"><!-- check this in original -->
       <xsl:element name="ReferenceURL" namespace="">
         <xsl:apply-templates select="@* | node()"/>
      </xsl:element>
    </xsl:template>
     <xsl:template match="impl:LongName"><!-- check this in original -->
       <xsl:element name="longName" namespace="">
         <xsl:apply-templates select="@* | node()"/>
      </xsl:element>
    </xsl:template>

   
   <!-- copy-all template - matches everything else -->
   <xsl:template match="node()|@*" >
      <xsl:copy> <!-- was:  name="{name()}" -->
         <xsl:apply-templates select="@* | node()"/>
      </xsl:copy>
   </xsl:template>
   
<!--
 $Log: CEA_UpdateTo1.0.xsl,v $
 Revision 1.4  2006/07/21 10:35:08  pharriso
 cleanup of cea and new vospace

 Revision 1.3  2006/07/20 10:58:31  pharriso
 various cleaning up of CEA + everything seemed to get local changes

 Revision 1.2  2006/06/30 08:07:49  pharriso
 updating a few comments

 Revision 1.1  2006/06/14 06:26:02  pharriso
 beginning of a CEA update script...

 -->
</xsl:stylesheet>
