Index: XIOS3/trunk/src/cxios.cpp
===================================================================
--- XIOS3/trunk/src/cxios.cpp	(revision 2437)
+++ XIOS3/trunk/src/cxios.cpp	(revision 2438)
@@ -15,4 +15,5 @@
 #include "servers_ressource.hpp"
 #include "mem_checker.hpp"
+#include <unistd.h>
 
 namespace xios
@@ -71,6 +72,16 @@
   {
     set_new_handler(noMemory);
+    char startPath[256];
+    getcwd(startPath, sizeof(startPath));
+    if(const char* userPath = std::getenv("XIOS_IODEF_PATH"))
+    {
+      if ( chdir( userPath ) != 0)
+      {
+        ERROR("CXios::initialize()", << "XIOS_IODEF_PATH not defined correctly : " << userPath << endl );
+      }
+    }
     parseFile(rootFile);
     parseXiosConfig();
+    chdir( startPath );
   }
 
@@ -199,6 +210,16 @@
     std::set<StdString> parseList;
     parseList.insert("xios");
+    char startPath[256];
+    getcwd(startPath, sizeof(startPath));
+    if(const char* userPath = std::getenv("XIOS_IODEF_PATH"))
+    {
+      if ( chdir( userPath ) != 0)
+      {
+        ERROR("CXios::initialize()", << "XIOS_IODEF_PATH not defined correctly : " << userPath << endl );
+      }
+    }
     xml::CXMLParser::ParseFile(rootFile, parseList);
     parseXiosConfig();
+    chdir( startPath );
   }
 
Index: XIOS3/trunk/src/node/context.cpp
===================================================================
--- XIOS3/trunk/src/node/context.cpp	(revision 2437)
+++ XIOS3/trunk/src/node/context.cpp	(revision 2438)
@@ -35,4 +35,5 @@
 #include <chrono>
 #include <random>
+#include <unistd.h>
 
 namespace xios
@@ -162,8 +163,54 @@
       if (attributes.end() != attributes.find("src"))
       {
-         StdIFStream ifs ( attributes["src"].c_str() , StdIFStream::in );
+         string srcString = attributes["src"].c_str();
+
+         // check if environment variables
+         string srcKey;         
+         if (srcString.find("${") == 0) // src start wit
+         {
+           size_t envVarStart = srcString.find("${")+2; // +2 for ${
+           if (srcString.find("}") != std::string::npos)
+           {
+             size_t envVarEnd = srcString.find("}")-2;  // -2 (start @ srcString begining, not after ${
+             if(const char* var_path = std::getenv( srcString.substr( envVarStart, envVarEnd ).c_str() ) )
+             {
+               srcKey=string(var_path)+"/"+srcString.substr( srcString.find("}")+1, srcString.size()-srcString.find("}") );
+             }
+             else
+             {
+               ERROR("void CContext::parse(xml::CXMLNode & node)",
+                     <<endl<< "The src key " << attributes["src"].c_str()<< " contains an undefined variable." );
+             }
+           }
+           else
+           {
+             ERROR("void CContext::parse(xml::CXMLNode & node)",
+                   <<endl<< "The src key " << attributes["src"].c_str()<< " not defined correctly." );
+           }
+         }
+         else if (srcString.find("${") != 0)
+         {
+           ERROR("void CContext::parse(xml::CXMLNode & node)",
+                   <<endl<< "The src key " << attributes["src"].c_str()<< " should start with $" );
+         }
+         else if (srcString.find("$") != std::string::npos)
+         {
+           ERROR("void CContext::parse(xml::CXMLNode & node)",
+                   <<endl<< "The src key " << attributes["src"].c_str()<< " need { and }." );
+         }
+         else // standard behavor, without environment variable
+         {
+           srcKey = attributes["src"].c_str();
+         }
+         
+         StdIFStream ifs ( srcKey , StdIFStream::in );
          if ( (ifs.rdstate() & std::ifstream::failbit ) != 0 )
+         {
+            char currentPath[256];
+            getcwd(currentPath, sizeof(currentPath));
             ERROR("void CContext::parse(xml::CXMLNode & node)",
-                  <<endl<< "Can not open <"<<attributes["src"].c_str()<<"> file" );
+                  <<endl<< "Can not open <"<<attributes["src"].c_str()<<"> file "
+                  << "from iodef path : " << currentPath );
+         }
          if (!ifs.good())
             ERROR("CContext::parse(xml::CXMLNode & node)",
