← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~fcavalieri/zorba/structuralrelationships into lp:zorba

 

Federico Cavalieri has proposed merging lp:~fcavalieri/zorba/structuralrelationships into lp:zorba.

Requested reviews:
  Markos Zaharioudakis (markos-za)

For more details, see:
https://code.launchpad.net/~fcavalieri/zorba/structuralrelationships/+merge/78375

New module node-structural-information.
This module allows to retrieve an xs:anyURI representation of a
node position. This module also defines function that determine: 
(1) the relationship between two nodes (e.g. if one is the ancestor
of another) and (2) properties of a node (e.g. its level in the tree)
given the corresponding nodes positions.
-- 
https://code.launchpad.net/~fcavalieri/zorba/structuralrelationships/+merge/78375
Your team Zorba Coders is subscribed to branch lp:zorba.
=== added file 'NOTICE.txt'
--- NOTICE.txt	1970-01-01 00:00:00 +0000
+++ NOTICE.txt	2011-10-06 09:58:24 +0000
@@ -0,0 +1,740 @@
+-----------
+Zorba 2.0.1
+-----------
+
+(Note: This file is generated automatically from NOTICE.xml.
+Please do not modify this file directly.)
+
+
+
+
+Apache 2
+
+      Copyright 2006-2011 The FLWOR Foundation
+
+      See LICENSE.txt for license information.
+
+      ------------------------
+      This product includes software developed at
+      The FLWOR Foundation (http://www.flworfound.org/).
+
+      ------------------------
+      Portions of this software were developed at the Systems
+      Group of the ETH Zurich, Switzerland.
+    
+
+Other files used by this project:
+----------------------------------------------------
+
+src/zorbatypes/m_apm.h
+src/zorbatypes/mapm/
+
+Copyright: 1999-2007 Michael C. Ring
+Website: http://www.tc.umn.edu/~ringx004/mapm-main.html
+
+      This software is Freeware.
+
+      Permission to use, copy, and distribute this software and its
+      documentation for any purpose with or without fee is hereby granted,
+      provided that the above copyright notice appear in all copies and
+      that both that copyright notice and this permission notice appear
+      in supporting documentation.
+
+      Permission to modify the software is granted. Permission to distribute
+      the modified code is granted. Modifications are to be distributed by
+      using the file 'license.txt' as a template to modify the file header.
+      'license.txt' is available in the official MAPM distribution.
+
+      To distribute modified source code, insert the file 'license.txt'
+      at the top of all modified source code files and edit accordingly.
+
+      This software is provided "as is" without express or implied warranty.
+    
+----------------------------------------------------
+
+src/zorbamisc/config/stdint.h
+
+Copyright: 2006 Alexander Chemeris
+
+
+      Redistribution and use in source and binary forms, with or without
+      modification, are permitted provided that the following conditions are met:
+
+      1. Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+
+      2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+
+      3. The name of the author may be used to endorse or promote products
+      derived from this software without specific prior written permission.
+
+      THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+      WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+      MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+      EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+      SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+      PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+      OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+      WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+      OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+      ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+    
+----------------------------------------------------
+
+src/zorbautils/stemmer/
+
+Copyright: 2001 Dr. Martin Porter
+
+
+      All the software given out on this Snowball site is covered by the BSD
+      License (see http://www.opensource.org/licenses/bsd-license.html), with
+      Copyright (c) 2001, Dr Martin Porter, and (for the Java developments)
+      Copyright (c) 2002, Richard Boulton.
+
+      Essentially, all this means is that you can do what you like with the code,
+      except claim another Copyright for it, or claim that it is issued under a
+      different license. The software is also issued without warranties, which
+      means that if anyone suffers through its use, they cannot come back and sue
+      you. You also have to alert anyone to whom you give the Snowball software to
+      the fact that it is covered by the BSD license.
+
+      We have not bothered to insert the licensing arrangement into the text of
+      the Snowball software.
+    
+----------------------------------------------------
+
+src/util/less.h
+
+Copyright: 1998 Paul J. Lucas
+
+
+      Redistribution and use in source and binary forms, with or without
+      modification, are permitted provided that the following conditions are met:
+
+      o  Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+
+      o  Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+
+      o  The name of the author may not be used to endorse or promote products
+      derived from this software without specific prior written permission.
+
+      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+      AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+      IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+      ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+      LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+      CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+      SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+      INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+      CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+      ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+      POSSIBILITY OF SUCH DAMAGE.
+    
+----------------------------------------------------
+
+src/util/auto_vector.h (has been modified)
+
+Copyright: 2003 Reliable Software
+
+
+      Redistribution and use in source and binary forms, with or without
+      modification, are permitted provided that the following conditions are met:
+
+      o  Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+
+      o  Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+
+      o  The name of the author may not be used to endorse or promote products
+      derived from this software without specific prior written permission.
+
+      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+      AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+      IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+      ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+      LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+      CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+      SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+      INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+      CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+      ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+      POSSIBILITY OF SUCH DAMAGE.
+    
+----------------------------------------------------
+
+cmake_modules/FindBoost.cmake
+
+Copyright: 
+      2006-2008 Andreas Schneider <mail@xxxxxxxxxxxx>
+      2007      Wengo
+      2007      Mike Jackson
+      2008      Andreas Pakulat <apaku@xxxxxx>
+    
+
+
+      Redistribution AND use is allowed according to the terms of the New BSD license.
+      For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+    
+----------------------------------------------------
+
+cmake_modules/FindJNI.cmake
+cmake_modules/FindPythonLibs.cmake
+cmake_modules/FindSWIG.cmake
+
+Copyright: 2001-2009 Kitware, Inc.
+
+
+      Distributed under the OSI-approved BSD License (the "License");
+      see accompanying file Copyright.txt for details.
+
+      This software is distributed WITHOUT ANY WARRANTY; without even the
+      implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+      See the License for more information.
+
+      CMake - Cross Platform Makefile Generator
+      Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+      All rights reserved.
+
+      Redistribution and use in source and binary forms, with or without
+      modification, are permitted provided that the following conditions
+      are met:
+
+      * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+
+      * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+
+      * Neither the names of Kitware, Inc., the Insight Software Consortium,
+      nor the names of their contributors may be used to endorse or promote
+      products derived from this software without specific prior written
+      permission.
+
+      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+      "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+      LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+      A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+      HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+      SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+      LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+      DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+      THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+      (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+      OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+      ------------------------------------------------------------------------------
+
+      The above copyright and license notice applies to distributions of
+      CMake in source and binary form.  Some source files contain additional
+      notices of original copyright by their contributors; see each source
+      for details.  Third-party software packages supplied with CMake under
+      compatible licenses provide their own copyright notices documented in
+      corresponding subdirectories.
+
+      ------------------------------------------------------------------------------
+
+      CMake was initially developed by Kitware with the following sponsorship:
+
+      * National Library of Medicine at the National Institutes of Health
+      as part of the Insight Segmentation and Registration Toolkit (ITK).
+
+      * US National Labs (Los Alamos, Livermore, Sandia) ASC Parallel
+      Visualization Initiative.
+
+      * National Alliance for Medical Image Computing (NAMIC) is funded by the
+      National Institutes of Health through the NIH Roadmap for Medical Research,
+      Grant U54 EB005149.
+
+      * Kitware, Inc.
+    
+----------------------------------------------------
+
+/xml.xsd
+
+Copyright: 2001 World Wide Web Consortium, (Massachusetts Institute of Technology, European Research Consortium for Informatics and Mathematics, Keio University)
+
+
+      All Rights Reserved. This work is distributed under the W3C Software License [1] in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+      W3C Software Notice and License
+
+      This work (and included software, documentation such as READMEs, or other related items) is being provided by the copyright holders under the following license.
+
+      License
+
+      By obtaining, using and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions.
+
+      Permission to copy, modify, and distribute this software and its documentation, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the software and documentation or portions thereof, including modifications:
+      •The full text of this NOTICE in a location viewable to users of the redistributed or derivative work.
+      •Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, the W3C Software Short Notice should be included (hypertext is preferred, text is permitted) within the body of any redistributed or derivative code.
+      •Notice of any changes or modifications to the files, including the date changes were made. (We recommend you provide URIs to the location from which the code is derived.)
+
+      Disclaimers
+
+      THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
+
+      COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
+
+      The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the software without specific, written prior permission. Title to copyright in this software and any associated documentation will at all times remain with copyright holders.
+    
+----------------------------------------------------
+
+schemas/xslt-xquery-serialization.xsd
+
+Copyright: 2010 World Wide Web Consortium, (Massachusetts Institute of Technology, European Research Consortium for Informatics and Mathematics, Keio University)
+
+
+      All Rights Reserved. This work is distributed under the W3C Software License [1] in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+      W3C Software Notice and License
+
+      This work (and included software, documentation such as READMEs, or other related items) is being provided by the copyright holders under the following license.
+
+      License
+
+      By obtaining, using and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions.
+
+      Permission to copy, modify, and distribute this software and its documentation, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the software and documentation or portions thereof, including modifications:
+      •The full text of this NOTICE in a location viewable to users of the redistributed or derivative work.
+      •Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, the W3C Software Short Notice should be included (hypertext is preferred, text is permitted) within the body of any redistributed or derivative code.
+      •Notice of any changes or modifications to the files, including the date changes were made. (We recommend you provide URIs to the location from which the code is derived.)
+
+      Disclaimers
+
+      THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
+
+      COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
+
+      The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the software without specific, written prior permission. Title to copyright in this software and any associated documentation will at all times remain with copyright holders.
+    
+----------------------------------------------------
+
+modules/w3c/xpath-functions.xsd
+
+Copyright: 2005 World Wide Web Consortium, (Massachusetts Institute of Technology, European Research Consortium for Informatics and Mathematics, Keio University)
+
+
+      All Rights Reserved. This work is distributed under the W3C Software License [1] in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+      W3C Software Notice and License
+
+      This work (and included software, documentation such as READMEs, or other related items) is being provided by the copyright holders under the following license.
+
+      License
+
+      By obtaining, using and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions.
+
+      Permission to copy, modify, and distribute this software and its documentation, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the software and documentation or portions thereof, including modifications:
+      •The full text of this NOTICE in a location viewable to users of the redistributed or derivative work.
+      •Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, the W3C Software Short Notice should be included (hypertext is preferred, text is permitted) within the body of any redistributed or derivative code.
+      •Notice of any changes or modifications to the files, including the date changes were made. (We recommend you provide URIs to the location from which the code is derived.)
+
+      Disclaimers
+
+      THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
+
+      COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
+
+      The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the software without specific, written prior permission. Title to copyright in this software and any associated documentation will at all times remain with copyright holders.
+    
+----------------------------------------------------
+
+include/xqc.h
+
+Copyright: 2008, Matthias Brantner, John Snelson
+
+
+      * All rights reserved.
+      *
+      * Redistribution and use in source and binary forms, with or without
+      * modification, are permitted provided that the following conditions are met:
+      *
+      *     * Redistributions of source code must retain the above copyright notice,
+      *       this list of conditions and the following disclaimer.
+      *     * Redistributions in binary form must reproduce the above copyright
+      *       notice, this list of conditions and the following disclaimer in the
+      *       documentation and/or other materials provided with the distribution.
+      *     * Neither the name of the developers nor the names of contributors may be
+      *       used to endorse or promote products derived from this software without
+      *       specific prior written permission.
+      *
+      * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+      * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+      * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+      * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+      * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+      * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+      * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+      * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+      * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+      * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+      * POSSIBILITY OF SUCH DAMAGE.
+    
+----------------------------------------------------
+
+modules/functx/functx.xq
+
+Copyright: 2007 Datypic
+
+
+      : This library is free software; you can redistribute it and/or
+      : modify it under the terms of the GNU Lesser General Public
+      : License as published by the Free Software Foundation; either
+      : version 2.1 of the License.
+
+      : This library is distributed in the hope that it will be useful,
+      : but WITHOUT ANY WARRANTY; without even the implied warranty of
+      : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+      : Lesser General Public License for more details.
+
+      : You should have received a copy of the GNU Lesser General Public
+      : License along with this library; if not, write to the Free Software
+      : Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+    
+----------------------------------------------------
+
+src/compiler/parser/FlexLexer.h
+
+Copyright: 1993 The Regents of the University of California
+
+
+      // All rights reserved.
+      //
+      // This code is derived from software contributed to Berkeley by
+      // Kent Williams and Tom Epperly.
+      //
+      //  Redistribution and use in source and binary forms, with or without
+      //  modification, are permitted provided that the following conditions
+      //  are met:
+
+      //  1. Redistributions of source code must retain the above copyright
+      //  notice, this list of conditions and the following disclaimer.
+      //  2. Redistributions in binary form must reproduce the above copyright
+      //  notice, this list of conditions and the following disclaimer in the
+      //  documentation and/or other materials provided with the distribution.
+
+      //  Neither the name of the University nor the names of its contributors
+      //  may be used to endorse or promote products derived from this software
+      //  without specific prior written permission.
+
+      //  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+      //  IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+      //  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+      //  PURPOSE.
+    
+----------------------------------------------------
+
+src/diagnostics/StackWalker.cpp
+src/diagnostics/StackWalker.h
+
+Copyright: 2005 Jochen Kalmbach 
+
+
+      Under BSD License: http://www.opensource.org/licenses/bsd-license.php
+    
+----------------------------------------------------
+
+src/util/singleton.h
+src/util/threads.h
+
+Copyright: 2001 Andrei Alexandrescu
+
+
+      This code accompanies the book:
+      Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design
+          Patterns Applied". Copyright (c) 2001. Addison-Wesley.
+      Permission to use, copy, modify, distribute and sell this software for any
+          purpose is hereby granted without fee, provided that the above copyright
+          notice appear in all copies and that both that copyright notice and this
+          permission notice appear in supporting documentation.
+      The author or Addison-Wesley Longman make no representations about the
+          suitability of this software for any purpose. It is provided "as is"
+          without express or implied warranty.
+    
+
+External libraries used by this project:
+----------------------------------------------------
+
+Name: LIBXML2
+Preferred version: 2.2.16 or higher
+Is mandatory: true
+Website: http://xmlsoft.org/
+License: MIT
+Copyright: 1998-2002 Daniel Veillard.  All Rights Reserved.
+External notice: 
+
+      Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+      The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+      Except as contained in this notice, the name of Daniel Veillard shall not
+      be used in advertising or otherwise to promote the sale, use or other deal-
+      ings in this Software without prior written authorization from him.
+    
+----------------------------------------------------
+
+Name: LIBXSLT
+Preferred version: 1.1.26
+Is mandatory: false
+Website: http://xmlsoft.org/XSLT/
+License: MIT
+Copyright: 2001-2002 Daniel Veillard.  All Rights Reserved.
+External notice: 
+
+      Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+      The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DANIEL VEILLARD BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+      Except as contained in this notice, the name of Daniel Veillard shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from him.
+
+    
+----------------------------------------------------
+
+Name: ICU4C
+Preferred version: 3.6 or higher
+Is mandatory: true
+Website: http://www.icu-project.org/
+License: ICU License
+Copyright: 1995-2011 International Business Machines Corporation and others 
+External notice: 
+
+      Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, provided that the above copyright notice(s) and this permission notice appear in all copies of the Software and that both the above copyright notice(s) and this permission notice appear in supporting documentation.
+
+      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+      Except as contained in this notice, the name of a copyright holder shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization of the copyright holder.
+    
+----------------------------------------------------
+
+Name: CURL
+Preferred version: above 7.12
+Is mandatory: false
+Website: http://curl.haxx.se/
+License: MIT/X derivate license
+Copyright: 1996 - 2011, Daniel Stenberg, <daniel@xxxxxxx>.
+External notice: 
+
+      All rights reserved.
+
+      Permission to use, copy, modify, and distribute this software for any purpose
+      with or without fee is hereby granted, provided that the above copyright
+      notice and this permission notice appear in all copies.
+
+      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+      IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+      FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN
+      NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+      DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+      OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
+      OR OTHER DEALINGS IN THE SOFTWARE.
+
+      Except as contained in this notice, the name of a copyright holder shall not
+      be used in advertising or otherwise to promote the sale, use or other dealings
+      in this Software without prior written authorization of the copyright holder.
+    
+----------------------------------------------------
+
+Name: ICONV
+Preferred version: above 1.12
+Is mandatory: true
+Website: http://www.gnu.org/software/libiconv/
+License: LGPL
+Copyright: 1998, 2010 Free Software Foundation, Inc.
+External notice: 
+
+----------------------------------------------------
+
+Name: ZLIB
+Preferred version: 1.2.5
+Is mandatory: true
+Website: http://www.zlib.net/
+Copyright: 1995-2004 Jean-loup Gailly and Mark Adler
+External notice: 
+
+      This software is provided 'as-is', without any express or implied
+      warranty.  In no event will the authors be held liable for any damages
+      arising from the use of this software.
+
+      Permission is granted to anyone to use this software for any purpose,
+      including commercial applications, and to alter it and redistribute it
+      freely, subject to the following restrictions:
+
+      1. The origin of this software must not be misrepresented; you must not
+      claim that you wrote the original software. If you use this software
+      in a product, an acknowledgment in the product documentation would be
+      appreciated but is not required.
+      2. Altered source versions must be plainly marked as such, and must not be
+      misrepresented as being the original software.
+      3. This notice may not be removed or altered from any source distribution.
+
+      Jean-loup Gailly jloup@xxxxxxxx
+      Mark Adler madler@xxxxxxxxxxxxxxxxxx
+    
+----------------------------------------------------
+
+Name: XERCES
+Preferred version: 2.8.0 or higher
+Is mandatory: true
+Website: http://xerces.apache.org/xerces-c/
+License: Apache 2
+Copyright: Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.
+External notice: 
+
+      http://www.apache.org/licenses/LICENSE-2.0
+    
+----------------------------------------------------
+
+Name: BOOST (boost_filesystem)
+Preferred version: 1.32 or higher
+Is mandatory: false
+Website: http://www.boost.org/
+License: Boost Software License v1.0
+Copyright: 
+      Beman Dawes, David Abrahams, 1998-2005.
+      Rene Rivera 2004-2007
+    
+External notice: 
+
+      Permission is hereby granted, free of charge, to any person or organization
+      obtaining a copy of the software and accompanying documentation covered by
+      this license (the "Software") to use, reproduce, display, distribute,
+      execute, and transmit the Software, and to prepare derivative works of the
+      Software, and to permit third-parties to whom the Software is furnished to
+      do so, all subject to the following:
+
+      The copyright notices in the Software and this entire statement, including
+      the above license grant, this restriction and the following disclaimer,
+      must be included in all copies of the Software, in whole or in part, and
+      all derivative works of the Software, unless such copies or derivative
+      works are solely in the form of machine-executable object code generated by
+      a source language processor.
+
+      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+      IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+      FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+      SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+      FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+      ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+      DEALINGS IN THE SOFTWARE.
+    
+
+External applications used by this project:
+----------------------------------------------------
+
+Name: FLEX
+Preferred version: 2.5.33
+Is mandatory: false
+Website: http://flex.sourceforge.net/
+Copyright: 
+      2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The Flex Project.
+      1990, 1997 The Regents of the University of California. All rights reserved.
+    
+External notice: 
+
+      Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+      1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+      2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+      
+      Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+      THIS SOFTWARE IS PROVIDED “AS IS” AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+    
+----------------------------------------------------
+
+Name: BISON
+Preferred version: 2.4 or higher
+Is mandatory: false
+Website: http://www.gnu.org/software/bison/
+License: GPL
+Copyright: 1998, 2001, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+External notice: 
+
+----------------------------------------------------
+
+Name: DOXYGEN
+Preferred version: v1.7.4 
+Is mandatory: false
+Website: www.doxygen.org
+License: GPL
+Copyright: 1997-2011 by Dimitri van Heesch
+External notice: 
+
+      Permission to use, copy, modify, and distribute this software and its documentation under the terms of the GNU General Public License is hereby granted.
+      No representations are made about the suitability of this software for any purpose. 
+      It is provided "as is" without express or implied warranty. 
+      See the GNU General Public License for more details.
+
+      Documents produced by doxygen are derivative works derived from the input used in their production; they are not affected by this license.
+    
+----------------------------------------------------
+
+Name: CMAKE
+Preferred version: 2.8.4
+Is mandatory: true
+Website: http://www.cmake.org/
+License: Creative Commons Attribution-NoDerivs 3.0 Unported License
+Copyright: 2000-2009 Kitware, Inc., Insight Software Consortium. All rights reserved.
+External notice: 
+
+      Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+      Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+      Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+      Neither the names of Kitware, Inc., the Insight Software Consortium, nor the names of their contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+    
+----------------------------------------------------
+
+Name: SWIG
+Preferred version: 2.0.4 or above
+Is mandatory: false
+Website: http://www.swig.org/
+License: GPL
+Copyright: 
+      1995-2011 The SWIG Developers
+      2005-2006 Arizona Board of Regents (University of Arizona).
+      1998-2005 University of Chicago.
+      1995-1998 The University of Utah and the Regents of the University of California
+    
+External notice: 
+
+      SWIG is free software: you can redistribute it and/or modify it
+      under the terms of the GNU General Public License as published by
+      the Free Software Foundation, either version 3 of the License, or
+      (at your option) any later version. See the LICENSE-GPL file for
+      the full terms of the GNU General Public license version 3.
+
+      Portions of SWIG are also licensed under the terms of the licenses
+      in the file LICENSE-UNIVERSITIES. You must observe the terms of
+      these licenses, as well as the terms of the GNU General Public License,
+      when you distribute SWIG.
+
+      The SWIG library and examples, under the Lib and Examples top level
+      directories, are distributed under the following terms:
+
+      You may copy, modify, distribute, and make derivative works based on
+      this software, in source code or object code form, without
+      restriction. If you distribute the software to others, you may do
+      so according to the terms of your choice. This software is offered as
+      is, without warranty of any kind.
+
+      See the COPYRIGHT file for a list of contributors to SWIG and their
+      copyright notices.
+    
\ No newline at end of file

=== removed file 'NOTICE.txt'
--- NOTICE.txt	2011-09-01 01:58:54 +0000
+++ NOTICE.txt	1970-01-01 00:00:00 +0000
@@ -1,740 +0,0 @@
------------
-Zorba 2.0.1
------------
-
-(Note: This file is generated automatically from NOTICE.xml.
-Please do not modify this file directly.)
-
-
-
-
-Apache 2
-
-      Copyright 2006-2011 The FLWOR Foundation
-
-      See LICENSE.txt for license information.
-
-      ------------------------
-      This product includes software developed at
-      The FLWOR Foundation (http://www.flworfound.org/).
-
-      ------------------------
-      Portions of this software were developed at the Systems
-      Group of the ETH Zurich, Switzerland.
-    
-
-Other files used by this project:
-----------------------------------------------------
-
-src/zorbatypes/m_apm.h
-src/zorbatypes/mapm/
-
-Copyright: 1999-2007 Michael C. Ring
-Website: http://www.tc.umn.edu/~ringx004/mapm-main.html
-
-      This software is Freeware.
-
-      Permission to use, copy, and distribute this software and its
-      documentation for any purpose with or without fee is hereby granted,
-      provided that the above copyright notice appear in all copies and
-      that both that copyright notice and this permission notice appear
-      in supporting documentation.
-
-      Permission to modify the software is granted. Permission to distribute
-      the modified code is granted. Modifications are to be distributed by
-      using the file 'license.txt' as a template to modify the file header.
-      'license.txt' is available in the official MAPM distribution.
-
-      To distribute modified source code, insert the file 'license.txt'
-      at the top of all modified source code files and edit accordingly.
-
-      This software is provided "as is" without express or implied warranty.
-    
-----------------------------------------------------
-
-src/zorbamisc/config/stdint.h
-
-Copyright: 2006 Alexander Chemeris
-
-
-      Redistribution and use in source and binary forms, with or without
-      modification, are permitted provided that the following conditions are met:
-
-      1. Redistributions of source code must retain the above copyright notice,
-      this list of conditions and the following disclaimer.
-
-      2. Redistributions in binary form must reproduce the above copyright
-      notice, this list of conditions and the following disclaimer in the
-      documentation and/or other materials provided with the distribution.
-
-      3. The name of the author may be used to endorse or promote products
-      derived from this software without specific prior written permission.
-
-      THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
-      WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-      MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
-      EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-      SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-      PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-      OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-      WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-      OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-      ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-    
-----------------------------------------------------
-
-src/zorbautils/stemmer/
-
-Copyright: 2001 Dr. Martin Porter
-
-
-      All the software given out on this Snowball site is covered by the BSD
-      License (see http://www.opensource.org/licenses/bsd-license.html), with
-      Copyright (c) 2001, Dr Martin Porter, and (for the Java developments)
-      Copyright (c) 2002, Richard Boulton.
-
-      Essentially, all this means is that you can do what you like with the code,
-      except claim another Copyright for it, or claim that it is issued under a
-      different license. The software is also issued without warranties, which
-      means that if anyone suffers through its use, they cannot come back and sue
-      you. You also have to alert anyone to whom you give the Snowball software to
-      the fact that it is covered by the BSD license.
-
-      We have not bothered to insert the licensing arrangement into the text of
-      the Snowball software.
-    
-----------------------------------------------------
-
-src/util/less.h
-
-Copyright: 1998 Paul J. Lucas
-
-
-      Redistribution and use in source and binary forms, with or without
-      modification, are permitted provided that the following conditions are met:
-
-      o  Redistributions of source code must retain the above copyright notice,
-      this list of conditions and the following disclaimer.
-
-      o  Redistributions in binary form must reproduce the above copyright
-      notice, this list of conditions and the following disclaimer in the
-      documentation and/or other materials provided with the distribution.
-
-      o  The name of the author may not be used to endorse or promote products
-      derived from this software without specific prior written permission.
-
-      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-      AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-      IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-      ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-      LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-      CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-      SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-      INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-      CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-      ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-      POSSIBILITY OF SUCH DAMAGE.
-    
-----------------------------------------------------
-
-src/util/auto_vector.h (has been modified)
-
-Copyright: 2003 Reliable Software
-
-
-      Redistribution and use in source and binary forms, with or without
-      modification, are permitted provided that the following conditions are met:
-
-      o  Redistributions of source code must retain the above copyright notice,
-      this list of conditions and the following disclaimer.
-
-      o  Redistributions in binary form must reproduce the above copyright
-      notice, this list of conditions and the following disclaimer in the
-      documentation and/or other materials provided with the distribution.
-
-      o  The name of the author may not be used to endorse or promote products
-      derived from this software without specific prior written permission.
-
-      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-      AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-      IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-      ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-      LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-      CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-      SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-      INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-      CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-      ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-      POSSIBILITY OF SUCH DAMAGE.
-    
-----------------------------------------------------
-
-cmake_modules/FindBoost.cmake
-
-Copyright: 
-      2006-2008 Andreas Schneider <mail@xxxxxxxxxxxx>
-      2007      Wengo
-      2007      Mike Jackson
-      2008      Andreas Pakulat <apaku@xxxxxx>
-    
-
-
-      Redistribution AND use is allowed according to the terms of the New BSD license.
-      For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-    
-----------------------------------------------------
-
-cmake_modules/FindJNI.cmake
-cmake_modules/FindPythonLibs.cmake
-cmake_modules/FindSWIG.cmake
-
-Copyright: 2001-2009 Kitware, Inc.
-
-
-      Distributed under the OSI-approved BSD License (the "License");
-      see accompanying file Copyright.txt for details.
-
-      This software is distributed WITHOUT ANY WARRANTY; without even the
-      implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-      See the License for more information.
-
-      CMake - Cross Platform Makefile Generator
-      Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-      All rights reserved.
-
-      Redistribution and use in source and binary forms, with or without
-      modification, are permitted provided that the following conditions
-      are met:
-
-      * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-
-      * Redistributions in binary form must reproduce the above copyright
-      notice, this list of conditions and the following disclaimer in the
-      documentation and/or other materials provided with the distribution.
-
-      * Neither the names of Kitware, Inc., the Insight Software Consortium,
-      nor the names of their contributors may be used to endorse or promote
-      products derived from this software without specific prior written
-      permission.
-
-      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-      "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-      LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-      A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-      HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-      SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-      LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-      DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-      THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-      (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-      OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-      ------------------------------------------------------------------------------
-
-      The above copyright and license notice applies to distributions of
-      CMake in source and binary form.  Some source files contain additional
-      notices of original copyright by their contributors; see each source
-      for details.  Third-party software packages supplied with CMake under
-      compatible licenses provide their own copyright notices documented in
-      corresponding subdirectories.
-
-      ------------------------------------------------------------------------------
-
-      CMake was initially developed by Kitware with the following sponsorship:
-
-      * National Library of Medicine at the National Institutes of Health
-      as part of the Insight Segmentation and Registration Toolkit (ITK).
-
-      * US National Labs (Los Alamos, Livermore, Sandia) ASC Parallel
-      Visualization Initiative.
-
-      * National Alliance for Medical Image Computing (NAMIC) is funded by the
-      National Institutes of Health through the NIH Roadmap for Medical Research,
-      Grant U54 EB005149.
-
-      * Kitware, Inc.
-    
-----------------------------------------------------
-
-/xml.xsd
-
-Copyright: 2001 World Wide Web Consortium, (Massachusetts Institute of Technology, European Research Consortium for Informatics and Mathematics, Keio University)
-
-
-      All Rights Reserved. This work is distributed under the W3C Software License [1] in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-      W3C Software Notice and License
-
-      This work (and included software, documentation such as READMEs, or other related items) is being provided by the copyright holders under the following license.
-
-      License
-
-      By obtaining, using and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions.
-
-      Permission to copy, modify, and distribute this software and its documentation, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the software and documentation or portions thereof, including modifications:
-      •The full text of this NOTICE in a location viewable to users of the redistributed or derivative work.
-      •Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, the W3C Software Short Notice should be included (hypertext is preferred, text is permitted) within the body of any redistributed or derivative code.
-      •Notice of any changes or modifications to the files, including the date changes were made. (We recommend you provide URIs to the location from which the code is derived.)
-
-      Disclaimers
-
-      THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
-
-      COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
-
-      The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the software without specific, written prior permission. Title to copyright in this software and any associated documentation will at all times remain with copyright holders.
-    
-----------------------------------------------------
-
-schemas/xslt-xquery-serialization.xsd
-
-Copyright: 2010 World Wide Web Consortium, (Massachusetts Institute of Technology, European Research Consortium for Informatics and Mathematics, Keio University)
-
-
-      All Rights Reserved. This work is distributed under the W3C Software License [1] in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-      W3C Software Notice and License
-
-      This work (and included software, documentation such as READMEs, or other related items) is being provided by the copyright holders under the following license.
-
-      License
-
-      By obtaining, using and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions.
-
-      Permission to copy, modify, and distribute this software and its documentation, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the software and documentation or portions thereof, including modifications:
-      •The full text of this NOTICE in a location viewable to users of the redistributed or derivative work.
-      •Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, the W3C Software Short Notice should be included (hypertext is preferred, text is permitted) within the body of any redistributed or derivative code.
-      •Notice of any changes or modifications to the files, including the date changes were made. (We recommend you provide URIs to the location from which the code is derived.)
-
-      Disclaimers
-
-      THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
-
-      COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
-
-      The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the software without specific, written prior permission. Title to copyright in this software and any associated documentation will at all times remain with copyright holders.
-    
-----------------------------------------------------
-
-modules/w3c/xpath-functions.xsd
-
-Copyright: 2005 World Wide Web Consortium, (Massachusetts Institute of Technology, European Research Consortium for Informatics and Mathematics, Keio University)
-
-
-      All Rights Reserved. This work is distributed under the W3C Software License [1] in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-      W3C Software Notice and License
-
-      This work (and included software, documentation such as READMEs, or other related items) is being provided by the copyright holders under the following license.
-
-      License
-
-      By obtaining, using and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions.
-
-      Permission to copy, modify, and distribute this software and its documentation, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the software and documentation or portions thereof, including modifications:
-      •The full text of this NOTICE in a location viewable to users of the redistributed or derivative work.
-      •Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, the W3C Software Short Notice should be included (hypertext is preferred, text is permitted) within the body of any redistributed or derivative code.
-      •Notice of any changes or modifications to the files, including the date changes were made. (We recommend you provide URIs to the location from which the code is derived.)
-
-      Disclaimers
-
-      THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
-
-      COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
-
-      The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the software without specific, written prior permission. Title to copyright in this software and any associated documentation will at all times remain with copyright holders.
-    
-----------------------------------------------------
-
-include/xqc.h
-
-Copyright: 2008, Matthias Brantner, John Snelson
-
-
-      * All rights reserved.
-      *
-      * Redistribution and use in source and binary forms, with or without
-      * modification, are permitted provided that the following conditions are met:
-      *
-      *     * Redistributions of source code must retain the above copyright notice,
-      *       this list of conditions and the following disclaimer.
-      *     * Redistributions in binary form must reproduce the above copyright
-      *       notice, this list of conditions and the following disclaimer in the
-      *       documentation and/or other materials provided with the distribution.
-      *     * Neither the name of the developers nor the names of contributors may be
-      *       used to endorse or promote products derived from this software without
-      *       specific prior written permission.
-      *
-      * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-      * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-      * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-      * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-      * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-      * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-      * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-      * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-      * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-      * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-      * POSSIBILITY OF SUCH DAMAGE.
-    
-----------------------------------------------------
-
-modules/functx/functx.xq
-
-Copyright: 2007 Datypic
-
-
-      : This library is free software; you can redistribute it and/or
-      : modify it under the terms of the GNU Lesser General Public
-      : License as published by the Free Software Foundation; either
-      : version 2.1 of the License.
-
-      : This library is distributed in the hope that it will be useful,
-      : but WITHOUT ANY WARRANTY; without even the implied warranty of
-      : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-      : Lesser General Public License for more details.
-
-      : You should have received a copy of the GNU Lesser General Public
-      : License along with this library; if not, write to the Free Software
-      : Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-    
-----------------------------------------------------
-
-src/compiler/parser/FlexLexer.h
-
-Copyright: 1993 The Regents of the University of California
-
-
-      // All rights reserved.
-      //
-      // This code is derived from software contributed to Berkeley by
-      // Kent Williams and Tom Epperly.
-      //
-      //  Redistribution and use in source and binary forms, with or without
-      //  modification, are permitted provided that the following conditions
-      //  are met:
-
-      //  1. Redistributions of source code must retain the above copyright
-      //  notice, this list of conditions and the following disclaimer.
-      //  2. Redistributions in binary form must reproduce the above copyright
-      //  notice, this list of conditions and the following disclaimer in the
-      //  documentation and/or other materials provided with the distribution.
-
-      //  Neither the name of the University nor the names of its contributors
-      //  may be used to endorse or promote products derived from this software
-      //  without specific prior written permission.
-
-      //  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
-      //  IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-      //  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-      //  PURPOSE.
-    
-----------------------------------------------------
-
-src/diagnostics/StackWalker.cpp
-src/diagnostics/StackWalker.h
-
-Copyright: 2005 Jochen Kalmbach 
-
-
-      Under BSD License: http://www.opensource.org/licenses/bsd-license.php
-    
-----------------------------------------------------
-
-src/util/singleton.h
-src/util/threads.h
-
-Copyright: 2001 Andrei Alexandrescu
-
-
-      This code accompanies the book:
-      Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design
-          Patterns Applied". Copyright (c) 2001. Addison-Wesley.
-      Permission to use, copy, modify, distribute and sell this software for any
-          purpose is hereby granted without fee, provided that the above copyright
-          notice appear in all copies and that both that copyright notice and this
-          permission notice appear in supporting documentation.
-      The author or Addison-Wesley Longman make no representations about the
-          suitability of this software for any purpose. It is provided "as is"
-          without express or implied warranty.
-    
-
-External libraries used by this project:
-----------------------------------------------------
-
-Name: LIBXML2
-Preferred version: 2.2.16 or higher
-Is mandatory: true
-Website: http://xmlsoft.org/
-License: MIT
-Copyright: 1998-2002 Daniel Veillard.  All Rights Reserved.
-External notice: 
-
-      Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-      The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-      Except as contained in this notice, the name of Daniel Veillard shall not
-      be used in advertising or otherwise to promote the sale, use or other deal-
-      ings in this Software without prior written authorization from him.
-    
-----------------------------------------------------
-
-Name: LIBXSLT
-Preferred version: 1.1.26
-Is mandatory: false
-Website: http://xmlsoft.org/XSLT/
-License: MIT
-Copyright: 2001-2002 Daniel Veillard.  All Rights Reserved.
-External notice: 
-
-      Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-      The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DANIEL VEILLARD BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-      Except as contained in this notice, the name of Daniel Veillard shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from him.
-
-    
-----------------------------------------------------
-
-Name: ICU4C
-Preferred version: 3.6 or higher
-Is mandatory: true
-Website: http://www.icu-project.org/
-License: ICU License
-Copyright: 1995-2011 International Business Machines Corporation and others 
-External notice: 
-
-      Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, provided that the above copyright notice(s) and this permission notice appear in all copies of the Software and that both the above copyright notice(s) and this permission notice appear in supporting documentation.
-
-      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-      Except as contained in this notice, the name of a copyright holder shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization of the copyright holder.
-    
-----------------------------------------------------
-
-Name: CURL
-Preferred version: above 7.12
-Is mandatory: false
-Website: http://curl.haxx.se/
-License: MIT/X derivate license
-Copyright: 1996 - 2011, Daniel Stenberg, <daniel@xxxxxxx>.
-External notice: 
-
-      All rights reserved.
-
-      Permission to use, copy, modify, and distribute this software for any purpose
-      with or without fee is hereby granted, provided that the above copyright
-      notice and this permission notice appear in all copies.
-
-      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-      IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-      FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN
-      NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-      DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-      OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
-      OR OTHER DEALINGS IN THE SOFTWARE.
-
-      Except as contained in this notice, the name of a copyright holder shall not
-      be used in advertising or otherwise to promote the sale, use or other dealings
-      in this Software without prior written authorization of the copyright holder.
-    
-----------------------------------------------------
-
-Name: ICONV
-Preferred version: above 1.12
-Is mandatory: true
-Website: http://www.gnu.org/software/libiconv/
-License: LGPL
-Copyright: 1998, 2010 Free Software Foundation, Inc.
-External notice: 
-
-----------------------------------------------------
-
-Name: ZLIB
-Preferred version: 1.2.5
-Is mandatory: true
-Website: http://www.zlib.net/
-Copyright: 1995-2004 Jean-loup Gailly and Mark Adler
-External notice: 
-
-      This software is provided 'as-is', without any express or implied
-      warranty.  In no event will the authors be held liable for any damages
-      arising from the use of this software.
-
-      Permission is granted to anyone to use this software for any purpose,
-      including commercial applications, and to alter it and redistribute it
-      freely, subject to the following restrictions:
-
-      1. The origin of this software must not be misrepresented; you must not
-      claim that you wrote the original software. If you use this software
-      in a product, an acknowledgment in the product documentation would be
-      appreciated but is not required.
-      2. Altered source versions must be plainly marked as such, and must not be
-      misrepresented as being the original software.
-      3. This notice may not be removed or altered from any source distribution.
-
-      Jean-loup Gailly jloup@xxxxxxxx
-      Mark Adler madler@xxxxxxxxxxxxxxxxxx
-    
-----------------------------------------------------
-
-Name: XERCES
-Preferred version: 2.8.0 or higher
-Is mandatory: true
-Website: http://xerces.apache.org/xerces-c/
-License: Apache 2
-Copyright: Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.
-External notice: 
-
-      http://www.apache.org/licenses/LICENSE-2.0
-    
-----------------------------------------------------
-
-Name: BOOST (boost_filesystem)
-Preferred version: 1.32 or higher
-Is mandatory: false
-Website: http://www.boost.org/
-License: Boost Software License v1.0
-Copyright: 
-      Beman Dawes, David Abrahams, 1998-2005.
-      Rene Rivera 2004-2007
-    
-External notice: 
-
-      Permission is hereby granted, free of charge, to any person or organization
-      obtaining a copy of the software and accompanying documentation covered by
-      this license (the "Software") to use, reproduce, display, distribute,
-      execute, and transmit the Software, and to prepare derivative works of the
-      Software, and to permit third-parties to whom the Software is furnished to
-      do so, all subject to the following:
-
-      The copyright notices in the Software and this entire statement, including
-      the above license grant, this restriction and the following disclaimer,
-      must be included in all copies of the Software, in whole or in part, and
-      all derivative works of the Software, unless such copies or derivative
-      works are solely in the form of machine-executable object code generated by
-      a source language processor.
-
-      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-      IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-      FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
-      SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
-      FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
-      ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-      DEALINGS IN THE SOFTWARE.
-    
-
-External applications used by this project:
-----------------------------------------------------
-
-Name: FLEX
-Preferred version: 2.5.33
-Is mandatory: false
-Website: http://flex.sourceforge.net/
-Copyright: 
-      2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The Flex Project.
-      1990, 1997 The Regents of the University of California. All rights reserved.
-    
-External notice: 
-
-      Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
-      1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-      2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-      
-      Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-      THIS SOFTWARE IS PROVIDED “AS IS” AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-    
-----------------------------------------------------
-
-Name: BISON
-Preferred version: 2.4 or higher
-Is mandatory: false
-Website: http://www.gnu.org/software/bison/
-License: GPL
-Copyright: 1998, 2001, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
-External notice: 
-
-----------------------------------------------------
-
-Name: DOXYGEN
-Preferred version: v1.7.4 
-Is mandatory: false
-Website: www.doxygen.org
-License: GPL
-Copyright: 1997-2011 by Dimitri van Heesch
-External notice: 
-
-      Permission to use, copy, modify, and distribute this software and its documentation under the terms of the GNU General Public License is hereby granted.
-      No representations are made about the suitability of this software for any purpose. 
-      It is provided "as is" without express or implied warranty. 
-      See the GNU General Public License for more details.
-
-      Documents produced by doxygen are derivative works derived from the input used in their production; they are not affected by this license.
-    
-----------------------------------------------------
-
-Name: CMAKE
-Preferred version: 2.8.4
-Is mandatory: true
-Website: http://www.cmake.org/
-License: Creative Commons Attribution-NoDerivs 3.0 Unported License
-Copyright: 2000-2009 Kitware, Inc., Insight Software Consortium. All rights reserved.
-External notice: 
-
-      Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
-      Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
-      Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
-      Neither the names of Kitware, Inc., the Insight Software Consortium, nor the names of their contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-    
-----------------------------------------------------
-
-Name: SWIG
-Preferred version: 2.0.4 or above
-Is mandatory: false
-Website: http://www.swig.org/
-License: GPL
-Copyright: 
-      1995-2011 The SWIG Developers
-      2005-2006 Arizona Board of Regents (University of Arizona).
-      1998-2005 University of Chicago.
-      1995-1998 The University of Utah and the Regents of the University of California
-    
-External notice: 
-
-      SWIG is free software: you can redistribute it and/or modify it
-      under the terms of the GNU General Public License as published by
-      the Free Software Foundation, either version 3 of the License, or
-      (at your option) any later version. See the LICENSE-GPL file for
-      the full terms of the GNU General Public license version 3.
-
-      Portions of SWIG are also licensed under the terms of the licenses
-      in the file LICENSE-UNIVERSITIES. You must observe the terms of
-      these licenses, as well as the terms of the GNU General Public License,
-      when you distribute SWIG.
-
-      The SWIG library and examples, under the Lib and Examples top level
-      directories, are distributed under the following terms:
-
-      You may copy, modify, distribute, and make derivative works based on
-      this software, in source code or object code form, without
-      restriction. If you distribute the software to others, you may do
-      so according to the terms of your choice. This software is offered as
-      is, without warranty of any kind.
-
-      See the COPYRIGHT file for a list of contributors to SWIG and their
-      copyright notices.
-    
\ No newline at end of file

=== modified file 'modules/com/zorba-xquery/www/modules/CMakeLists.txt'
--- modules/com/zorba-xquery/www/modules/CMakeLists.txt	2011-08-10 09:40:29 +0000
+++ modules/com/zorba-xquery/www/modules/CMakeLists.txt	2011-10-06 09:58:24 +0000
@@ -46,6 +46,8 @@
   URI "http://www.zorba-xquery.com/modules/math";)
 DECLARE_ZORBA_MODULE(FILE node-reference.xq VERSION 2.0
   URI "http://www.zorba-xquery.com/modules/node-reference";)
+DECLARE_ZORBA_MODULE(FILE node-structural-information.xq VERSION 2.0
+  URI "http://www.zorba-xquery.com/modules/node-structural-information";)
 DECLARE_ZORBA_MODULE(FILE node.xq VERSION 2.0
   URI "http://www.zorba-xquery.com/modules/node";)
 DECLARE_ZORBA_MODULE(FILE project_xqdoc.xq VERSION 2.0

=== added file 'modules/com/zorba-xquery/www/modules/node-structural-information.xq'
--- modules/com/zorba-xquery/www/modules/node-structural-information.xq	1970-01-01 00:00:00 +0000
+++ modules/com/zorba-xquery/www/modules/node-structural-information.xq	2011-10-06 09:58:24 +0000
@@ -0,0 +1,426 @@
+(:
+ : Copyright 2006-2011 The FLWOR Foundation.
+ :
+ : Licensed under the Apache License, Version 2.0 (the "License");
+ : you may not use this file except in compliance with the License.
+ : You may obtain a copy of the License at
+ :
+ : http://www.apache.org/licenses/LICENSE-2.0
+ :
+ : Unless required by applicable law or agreed to in writing, software
+ : distributed under the License is distributed on an "AS IS" BASIS,
+ : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ : See the License for the specific language governing permissions and
+ : limitations under the License.
+:)
+
+(:~
+ : This module allows to retrieve an xs:anyURI representation of a
+ : node position. This module also defines function that determine: 
+ : (1) the relationship between two nodes (e.g. if one is the ancestor
+ : of another) and (2) properties of a node (e.g. its level in the tree)
+ : given the corresponding nodes positions.
+ :
+ : @author Federico Cavalieri 
+ :)
+module namespace si = "http://www.zorba-xquery.com/modules/node-structural-information";;
+declare namespace ver = "http://www.zorba-xquery.com/options/versioning";;
+declare option ver:module-version "2.0";
+
+(:~
+ : Compute a stable and opaque structural information representation 
+ : (with type xs:anyURI) for a given node.
+ :
+ : <p>The returned URI is stable, i.e. it does not change when other 
+ : nodes are inserted, deleted or modified.</p>
+ : 
+ : <p>Each node in a snapshot has a different URI. Note however that
+ : different nodes in different snapshots might have the same URI.</p>  
+ :
+ : @param $arg the node for which the structural information URI
+ :  should be computed
+ :
+ : @return the opaque structural information URI of the node.
+ :)
+declare function si:node-structural-information(
+  $arg as node()
+) as xs:anyURI external;
+
+(:~
+ : Determines whether the node whose structural information is 
+ : given as second argument is an ancestor of the node whose 
+ : structural information is given as first argument.
+ :
+ : @param $s-info1 the potential descendant structural information
+ : @param $s-info2 the potential ancestor structural information
+ :
+ : @return true if the node whose structural information is $s-info2 
+ : is an ancestor of the node whose structural information is $s-info1;
+ : false otherwise.
+ :
+ : @error zerr::ZAPI0028 if one of the given URI is not a valid node structural
+ : information computed by the <tt>si:node-structural-information</tt> function. 
+ :)
+declare function si:ancestor-of(
+  $s-info1 as xs:anyURI,
+  $s-info2 as xs:anyURI) as xs:boolean external;
+
+(:~
+ : Determines whether the node whose structural information is 
+ : given as second argument is a descendant of the node whose 
+ : structural information is given as first argument.
+ :
+ : @param $s-info1 the potential ancestor structural information
+ : @param $s-info2 the potential descendant structural information
+ :
+ : @return true if the node whose structural information is $s-info2 
+ : is a descendant of the node whose structural information is $s-info1; 
+ : false otherwise.
+ :
+ : @error zerr::ZAPI0028 if one of the given URI is not a valid node structural
+ : information computed by the <tt>si:node-structural-information</tt> function.
+ :)
+declare function si:descendant-of(
+  $s-info1 as xs:anyURI,
+  $s-info2 as xs:anyURI) as xs:boolean external;
+
+(:~
+ : Determines whether the node whose structural information is 
+ : given as second argument is the parent of the node whose 
+ : structural information is given as first argument.
+ :
+ : @param $s-info1 the potential child structural information
+ : @param $s-info2 the potential parent structural information
+ :
+ : @return true if the node whose structural information is $s-info2
+ : is the parent of the node whose structural information is $s-info1; 
+ : false otherwise.
+ :
+ : @error zerr::ZAPI0028 if one of the given URI is not a valid node structural
+ : information computed by the <tt>si:node-structural-information</tt> function.
+ :)
+declare function si:parent-of(
+  $s-info1 as xs:anyURI,
+  $s-info2 as xs:anyURI) as xs:boolean external;
+
+(:~
+ : Determines whether the node whose structural information is 
+ : given as second argument is a child of the node whose 
+ : structural information is given as first argument.
+ :
+ : @param $s-info1 the potential parent structural information
+ : @param $s-info2 the potential child structural information
+ :
+ : @return true if the node whose structural information is $s-info2
+ : is a child of the node whose structural information is $s-info1; 
+ : false otherwise.
+ :
+ : @error zerr::ZAPI0028 if one of the given URI is not a valid node structural
+ : information computed by the <tt>si:node-structural-information</tt> function.
+ :)
+declare function si:child-of(
+  $s-info1 as xs:anyURI,
+  $s-info2 as xs:anyURI) as xs:boolean external;
+
+(:~
+ : Determines whether the node whose structural information is 
+ : given as second argument is an attribute of the node whose 
+ : structural information is given as first argument.
+ :
+ : @param $s-info1 the potential parent structural information
+ : @param $s-info2 the potential attribute structural information
+ :
+ : @return true if the node whose structural information is $s-info2
+ : is an attribute of the node whose structural information is $s-info1; 
+ : false otherwise.
+ :
+ : @error zerr::ZAPI0028 if one of the given URI is not a valid node structural
+ : information computed by the <tt>si:node-structural-information</tt> function.
+ :)
+declare function si:attribute-of(
+  $s-info1 as xs:anyURI,
+  $s-info2 as xs:anyURI) as xs:boolean external;
+
+(:~
+ : Determines whether the node whose structural information is 
+ : given as second argument is a following-sibling of the node 
+ : whose structural information is given as first argument.
+ :
+ : @param $s-info1 the potential preceding-sibling structural information
+ : @param $s-info2 the potential following-sibling structural information
+ :
+ : @return true if the node whose structural information is $s-info2
+ : is a following-sibling of the node whose structural information is $s-info1; 
+ : false otherwise.
+ :
+ : @error zerr::ZAPI0028 if one of the given URI is not a valid node structural
+ : information computed by the <tt>si:node-structural-information</tt> function.
+ :)
+declare function si:following-sibling-of(
+  $s-info1 as xs:anyURI,
+  $s-info2 as xs:anyURI) as xs:boolean external;
+
+(:~
+ : Determines whether the node whose structural information is 
+ : given as second argument is a preceding-sibling of the node 
+ : whose structural information is given as first argument.
+ :
+ : @param $s-info1 the potential following-sibling structural information
+ : @param $s-info2 the potential preceding-sibling structural information
+ :
+ : @return true if the node whose structural information is $s-info2 
+ : is a preceding-sibling of the node whose structural information is $s-info1; 
+ : false otherwise.
+ :
+ : @error zerr::ZAPI0028 if one of the given URI is not a valid node structural
+ : information computed by the <tt>si:node-structural-information</tt> function.
+ :)
+declare function si:preceding-sibling-of(
+  $s-info1 as xs:anyURI,
+  $s-info2 as xs:anyURI) as xs:boolean external;
+
+(:~
+ : Determines whether the node whose structural information is 
+ : given as second argument is following the node whose 
+ : structural information is given as first argument.
+ :
+ : @param $s-info1 the potential preceding node structural information
+ : @param $s-info2 the potential following node structural information
+ :
+ : @return true if the node whose structural information is $s-info2 
+ : is following the node whose structural information is $s-info1;
+ : false otherwise.
+ :
+ : @error zerr::ZAPI0028 if one of the given URI is not a valid node structural
+ : information computed by the <tt>si:node-structural-information</tt> function.
+ :)
+declare function si:following-of(
+  $s-info1 as xs:anyURI,
+  $s-info2 as xs:anyURI) as xs:boolean external;
+
+  
+(:~
+ : Determines whether the node whose structural information is 
+ : given as second argument is following in document order the node whose 
+ : structural information is given as first argument.
+ :
+ : @param $s-info1 the potential preceding node structural information
+ : @param $s-info2 the potential following node structural information
+ :
+ : @return true if the node whose structural information is $s-info2 
+ : is following in document order the node whose structural information
+ : is $s-info1; false otherwise.
+ :
+ : @error zerr::ZAPI0028 if one of the given URI is not a valid node structural
+ : information computed by the <tt>si:node-structural-information</tt> function.
+ :)
+declare function si:following-in-document-order-of(
+  $s-info1 as xs:anyURI,
+  $s-info2 as xs:anyURI) as xs:boolean external;
+
+
+(:~
+ : Determines whether the node whose structural information is 
+ : given as second argument is preceding the node whose 
+ : structural information is given as first argument.
+ :
+ : @param $s-info1 the potential following node structural information
+ : @param $s-info2 the potential preceding node structural information
+ :
+ : @return true if the node whose structural information is $s-info2 
+ : is preceding the node whose structural information is $s-info1; 
+ : false otherwise.
+ :
+ : @error zerr::ZAPI0028 if one of the given URI is not a valid node structural
+ : information computed by the <tt>si:node-structural-information</tt> function.
+ :)
+declare function si:preceding-of(
+  $s-info1 as xs:anyURI,
+  $s-info2 as xs:anyURI) as xs:boolean external;
+
+(:~
+ : Determines whether the node whose structural information is 
+ : given as second argument is preceding the node whose 
+ : structural information is given as first argument.
+ :
+ : @param $s-info1 the potential following node structural information
+ : @param $s-info2 the potential preceding node structural information
+ :
+ : @return true if the node whose structural information is $s-info2 
+ : is preceding in document order the node whose structural information 
+ : is $s-info1; false otherwise.
+ :
+ : @error zerr::ZAPI0028 if one of the given URI is not a valid node structural
+ : information computed by the <tt>si:node-structural-information</tt> function.
+ :)
+declare function si:preceding-in-document-order-of(
+  $s-info1 as xs:anyURI,
+  $s-info2 as xs:anyURI) as xs:boolean external;
+
+
+(:~
+ : Computes the level of a node in the tree given its structural
+ : information.
+ :
+ : Note: The first level has the number one.
+ :
+ : @param $s-info the structural information of the node which 
+ :  level should be computed
+ :
+ : @return The level in the tree as xs:integer of the node whose 
+ : structural information is $s-info.
+ :
+ : @error zerr::ZAPI0028 if one of the given URI is not a valid node structural
+ : information computed by the <tt>si:node-structural-information</tt> function.
+ :)
+declare function si:level(
+  $s-info as xs:anyURI) as xs:integer external;  
+
+(:~
+ : Determines whether two nodes are siblings given their structural information.
+ :
+ : @param $s-info1 a node structural information
+ : @param $s-info2 a node structural information
+ :
+ : @return true if the two nodes whose structural information are $s-info1
+ : and $s-info2 are siblings; false otherwise.
+ :
+ : @error zerr::ZAPI0028 if one of the given URI is not a valid node structural
+ : information computed by the <tt>si:node-structural-information</tt> function.
+ :)  
+declare function si:sibling-of(
+  $s-info1 as xs:anyURI,
+  $s-info2 as xs:anyURI) as xs:boolean external;
+  
+(:~
+ : Determines whether a node is an attribute given its structural information.
+ :
+ : @param $s-info the potential attribute structural information
+ :
+ : @return true if the node whose structural information is $s-info
+ : is an attribute; false otherwise.
+ :
+ : @error zerr::ZAPI0028 if the given URI is not a valid node structural
+ : information computed by the <tt>si:node-structural-information</tt> function.
+ :)
+declare function si:is-attribute(
+  $s-info1 as xs:anyURI) as xs:boolean external;
+
+(:~
+ : Determines whether a node is a comment given its structural information.
+ :
+ : @param $s-info the potential comment structural information
+ :
+ : @return true if the node whose structural information is $s-info
+ : is a comment; false otherwise.
+ :
+ : @error zerr::ZAPI0028 if the given URI is not a valid node structural
+ : information computed by the <tt>si:node-structural-information</tt> function.
+ :)
+declare function si:is-comment(
+  $s-info1 as xs:anyURI) as xs:boolean external;
+  
+  (:~
+ : Determines whether a node is a document given its structural information.
+ :
+ : @param $s-info the potential document structural information
+ :
+ : @return true if the node whose structural information is $s-info
+ : is a document; false otherwise.
+ :
+ : @error zerr::ZAPI0028 if the given URI is not a valid node structural
+ : information computed by the <tt>si:node-structural-information</tt> function.
+ :)
+declare function si:is-document(
+  $s-info1 as xs:anyURI) as xs:boolean external;
+  
+  (:~
+ : Determines whether a node is an element given its structural information.
+ :
+ : @param $s-info the potential element structural information
+ :
+ : @return true if the node whose structural information is $s-info
+ : is an element; false otherwise.
+ :
+ : @error zerr::ZAPI0028 if the given URI is not a valid node structural
+ : information computed by the <tt>si:node-structural-information</tt> function.
+ :)
+declare function si:is-element(
+  $s-info1 as xs:anyURI) as xs:boolean external;
+  
+  (:~
+ : Determines whether a node is a processing-instruction given its structural information.
+ :
+ : @param $s-info the potential processing-instruction structural information
+ :
+ : @return true if the node whose structural information is $s-info
+ : is a processing-instruction; false otherwise.
+ :
+ : @error zerr::ZAPI0028 if the given URI is not a valid node structural
+ : information computed by the <tt>si:node-structural-information</tt> function.
+ :)
+declare function si:is-processing-instruction(
+  $s-info1 as xs:anyURI) as xs:boolean external;
+  
+  (:~
+ : Determines whether a node is a text given its structural information.
+ :
+ : @param $s-info the potential text node structural information
+ :
+ : @return true if the node whose structural information is $s-info
+ : is a text node; false otherwise.
+ :
+ : @error zerr::ZAPI0028 if the given URI is not a valid node structural
+ : information computed by the <tt>si:node-structural-information</tt> function.
+ :)
+declare function si:is-text(
+  $s-info1 as xs:anyURI) as xs:boolean external;
+
+(:~
+ : Determines whether two nodes belong to the same tree given their
+ : structural information.
+ :
+ : @param $s-info1 a node structural information
+ : @param $s-info2 a node structural information
+ :
+ : @return true if the two node whose structural information are $s-info1
+ : and $s-info2 belong to the same tree.
+ :
+ : @error zerr::ZAPI0028 if one of the given URI is not a valid node structural
+ : information computed by the <tt>si:node-structural-information</tt> function.
+ :)  
+declare function si:in-same-tree-of(
+  $s-info1 as xs:anyURI,
+  $s-info2 as xs:anyURI) as xs:boolean external;
+
+(:~
+ : Determines whether a node belongs to a collection given its structural
+ : information.
+ :
+ : @param $s-info the node structural information
+ :
+ : @return true if the node whose structural information is $s-info 
+ : is in a collection; false otherwise.
+ :
+ : @error zerr::ZAPI0028 if the given URI is not a valid node structural
+ : information computed by the <tt>si:node-structural-information</tt> function.
+ :)
+declare function si:in-collection(
+  $s-info as xs:anyURI) as xs:boolean external;
+
+(:~
+ : Determines whether two nodes belong to the same collection given their
+ : structural information.
+ :
+ : @param $s-info1 a node structural information
+ : @param $s-info2 a node structural information
+ :
+ : @return true if the two node whose structural information are $s-info1
+ : and $s-info2 belong to the same collection.
+ :
+ : @error zerr::ZAPI0028 if one of the given URI is not a valid node structural
+ : information computed by the <tt>si:node-structural-information</tt> function.
+ :)  
+declare function si:in-same-collection-of(
+  $s-info1 as xs:anyURI,
+  $s-info2 as xs:anyURI) as xs:boolean external;

=== modified file 'src/context/static_context.cpp'
--- src/context/static_context.cpp	2011-09-06 14:05:29 +0000
+++ src/context/static_context.cpp	2011-10-06 09:58:24 +0000
@@ -280,6 +280,9 @@
 static_context::ZORBA_NODEREF_FN_NS = NS_PRE + "modules/node-reference";
 
 const zstring
+static_context::ZORBA_NODESTRUCT_FN_NS = NS_PRE + "modules/node-structural-information";
+
+const zstring
 static_context::ZORBA_STORE_DYNAMIC_COLLECTIONS_DDL_FN_NS
   = NS_PRE + "modules/store/dynamic/collections/ddl";
 
@@ -373,6 +376,7 @@
     return (ns == ZORBA_MATH_FN_NS ||
             ns == ZORBA_BASE64_FN_NS ||
             ns == ZORBA_NODEREF_FN_NS ||
+            ns == ZORBA_NODESTRUCT_FN_NS ||
             ns == ZORBA_STORE_DYNAMIC_DOCUMENTS_FN_NS ||
             ns == ZORBA_STORE_DYNAMIC_UNORDERED_MAP_FN_NS ||
             ns == ZORBA_STORE_DYNAMIC_COLLECTIONS_DDL_FN_NS ||

=== modified file 'src/context/static_context.h'
--- src/context/static_context.h	2011-08-31 13:17:59 +0000
+++ src/context/static_context.h	2011-10-06 09:58:24 +0000
@@ -459,6 +459,7 @@
   static const zstring ZORBA_MATH_FN_NS;
   static const zstring ZORBA_BASE64_FN_NS;
   static const zstring ZORBA_NODEREF_FN_NS;
+  static const zstring ZORBA_NODESTRUCT_FN_NS;
   static const zstring ZORBA_STORE_DYNAMIC_COLLECTIONS_DDL_FN_NS;
   static const zstring ZORBA_STORE_DYNAMIC_COLLECTIONS_DML_FN_NS;
   static const zstring ZORBA_STORE_STATIC_COLLECTIONS_DDL_FN_NS;

=== modified file 'src/functions/library.cpp'
--- src/functions/library.cpp	2011-07-03 13:45:27 +0000
+++ src/functions/library.cpp	2011-10-06 09:58:24 +0000
@@ -44,6 +44,7 @@
 #include "functions/func_ic_ddl.h"
 #include "functions/func_maths.h"
 #include "functions/func_nodes.h"
+#include "functions/func_structural.h"
 #include "functions/func_node_sort_distinct.h"
 #include "functions/func_numerics.h"
 #include "functions/func_numerics_impl.h"
@@ -108,6 +109,7 @@
   populate_context_ic_ddl(sctx);
   populate_context_maths(sctx);
   populate_context_nodes(sctx);
+  populate_context_structural(sctx);
   populate_context_numerics(sctx);
   populate_context_other_diagnostics(sctx);
   populate_context_parsing_and_serializing(sctx);

=== added file 'src/functions/pregenerated/func_structural.cpp'
--- src/functions/pregenerated/func_structural.cpp	1970-01-01 00:00:00 +0000
+++ src/functions/pregenerated/func_structural.cpp	2011-10-06 09:58:24 +0000
@@ -0,0 +1,561 @@
+/*
+ * Copyright 2006-2008 The FLWOR Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+// ******************************************
+// *                                        *
+// * THIS IS A GENERATED FILE. DO NOT EDIT! *
+// * SEE .xml FILE WITH SAME NAME           *
+// *                                        *
+// ******************************************
+
+
+#include "stdafx.h"
+#include "runtime/nodes/structural.h"
+#include "functions/func_structural.h"
+
+
+namespace zorba{
+
+
+
+PlanIter_t fn_zorba_struct_node_structural_information::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  AnnotationHolder& ann) const
+{
+  return new NodeStructuralInformationIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_struct_ancestor_of::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  AnnotationHolder& ann) const
+{
+  return new IsAncestorStructuralInformationIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_struct_following_sibling_of::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  AnnotationHolder& ann) const
+{
+  return new IsFollowingSiblingStructuralInformationIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_struct_following_of::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  AnnotationHolder& ann) const
+{
+  return new IsFollowingStructuralInformationIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_struct_descendant_of::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  AnnotationHolder& ann) const
+{
+  return new IsDescendantStructuralInformationIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_struct_preceding_sibling_of::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  AnnotationHolder& ann) const
+{
+  return new IsPrecedingSiblingStructuralInformationIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_struct_preceding_of::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  AnnotationHolder& ann) const
+{
+  return new IsPrecedingStructuralInformationIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_struct_child_of::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  AnnotationHolder& ann) const
+{
+  return new IsChildStructuralInformationIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_struct_attribute_of::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  AnnotationHolder& ann) const
+{
+  return new IsAttributeOfStructuralInformationIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_struct_parent_of::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  AnnotationHolder& ann) const
+{
+  return new IsParentStructuralInformationIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_struct_preceding_in_document_order_of::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  AnnotationHolder& ann) const
+{
+  return new IsPrecedingInDocumentOrderStructuralInformationIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_struct_following_in_document_order_of::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  AnnotationHolder& ann) const
+{
+  return new IsFollowingInDocumentOrderStructuralInformationIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_struct_level::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  AnnotationHolder& ann) const
+{
+  return new LevelStructuralInformationIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_struct_is_attribute::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  AnnotationHolder& ann) const
+{
+  return new IsAttributeStructuralInformationIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_struct_is_comment::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  AnnotationHolder& ann) const
+{
+  return new IsCommentStructuralInformationIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_struct_is_document::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  AnnotationHolder& ann) const
+{
+  return new IsDocumentStructuralInformationIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_struct_is_element::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  AnnotationHolder& ann) const
+{
+  return new IsElementStructuralInformationIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_struct_is_processing_instruction::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  AnnotationHolder& ann) const
+{
+  return new IsProcessingInstructionStructuralInformationIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_struct_is_text::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  AnnotationHolder& ann) const
+{
+  return new IsTextStructuralInformationIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_struct_sibling_of::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  AnnotationHolder& ann) const
+{
+  return new IsSiblingStructuralInformationIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_struct_in_same_tree_of::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  AnnotationHolder& ann) const
+{
+  return new InSameTreeStructuralInformationIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_struct_in_collection::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  AnnotationHolder& ann) const
+{
+  return new InCollectionStructuralInformationIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_struct_in_same_collection_of::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  AnnotationHolder& ann) const
+{
+  return new InSameCollectionStructuralInformationIterator(sctx, loc, argv);
+}
+
+void populate_context_structural(static_context* sctx)
+{
+  {
+    
+
+    DECL_WITH_KIND(sctx, fn_zorba_struct_node_structural_information,
+        (createQName("http://www.zorba-xquery.com/modules/node-structural-information","","node-structural-information";), 
+        GENV_TYPESYSTEM.ANY_NODE_TYPE_ONE, 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE),
+        FunctionConsts::FN_ZORBA_STRUCT_NODE_STRUCTURAL_INFORMATION_1);
+
+  }
+
+
+  {
+    
+
+    DECL_WITH_KIND(sctx, fn_zorba_struct_ancestor_of,
+        (createQName("http://www.zorba-xquery.com/modules/node-structural-information","","ancestor-of";), 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),
+        FunctionConsts::FN_ZORBA_STRUCT_ANCESTOR_OF_2);
+
+  }
+
+
+  {
+    
+
+    DECL_WITH_KIND(sctx, fn_zorba_struct_following_sibling_of,
+        (createQName("http://www.zorba-xquery.com/modules/node-structural-information","","following-sibling-of";), 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),
+        FunctionConsts::FN_ZORBA_STRUCT_FOLLOWING_SIBLING_OF_2);
+
+  }
+
+
+  {
+    
+
+    DECL_WITH_KIND(sctx, fn_zorba_struct_following_of,
+        (createQName("http://www.zorba-xquery.com/modules/node-structural-information","","following-of";), 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),
+        FunctionConsts::FN_ZORBA_STRUCT_FOLLOWING_OF_2);
+
+  }
+
+
+  {
+    
+
+    DECL_WITH_KIND(sctx, fn_zorba_struct_descendant_of,
+        (createQName("http://www.zorba-xquery.com/modules/node-structural-information","","descendant-of";), 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),
+        FunctionConsts::FN_ZORBA_STRUCT_DESCENDANT_OF_2);
+
+  }
+
+
+  {
+    
+
+    DECL_WITH_KIND(sctx, fn_zorba_struct_preceding_sibling_of,
+        (createQName("http://www.zorba-xquery.com/modules/node-structural-information","","preceding-sibling-of";), 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),
+        FunctionConsts::FN_ZORBA_STRUCT_PRECEDING_SIBLING_OF_2);
+
+  }
+
+
+  {
+    
+
+    DECL_WITH_KIND(sctx, fn_zorba_struct_preceding_of,
+        (createQName("http://www.zorba-xquery.com/modules/node-structural-information","","preceding-of";), 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),
+        FunctionConsts::FN_ZORBA_STRUCT_PRECEDING_OF_2);
+
+  }
+
+
+  {
+    
+
+    DECL_WITH_KIND(sctx, fn_zorba_struct_child_of,
+        (createQName("http://www.zorba-xquery.com/modules/node-structural-information","","child-of";), 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),
+        FunctionConsts::FN_ZORBA_STRUCT_CHILD_OF_2);
+
+  }
+
+
+  {
+    
+
+    DECL_WITH_KIND(sctx, fn_zorba_struct_attribute_of,
+        (createQName("http://www.zorba-xquery.com/modules/node-structural-information","","attribute-of";), 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),
+        FunctionConsts::FN_ZORBA_STRUCT_ATTRIBUTE_OF_2);
+
+  }
+
+
+  {
+    
+
+    DECL_WITH_KIND(sctx, fn_zorba_struct_parent_of,
+        (createQName("http://www.zorba-xquery.com/modules/node-structural-information","","parent-of";), 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),
+        FunctionConsts::FN_ZORBA_STRUCT_PARENT_OF_2);
+
+  }
+
+
+  {
+    
+
+    DECL_WITH_KIND(sctx, fn_zorba_struct_preceding_in_document_order_of,
+        (createQName("http://www.zorba-xquery.com/modules/node-structural-information","","preceding-in-document-order-of";), 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),
+        FunctionConsts::FN_ZORBA_STRUCT_PRECEDING_IN_DOCUMENT_ORDER_OF_2);
+
+  }
+
+
+  {
+    
+
+    DECL_WITH_KIND(sctx, fn_zorba_struct_following_in_document_order_of,
+        (createQName("http://www.zorba-xquery.com/modules/node-structural-information","","following-in-document-order-of";), 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),
+        FunctionConsts::FN_ZORBA_STRUCT_FOLLOWING_IN_DOCUMENT_ORDER_OF_2);
+
+  }
+
+
+  {
+    
+
+    DECL_WITH_KIND(sctx, fn_zorba_struct_level,
+        (createQName("http://www.zorba-xquery.com/modules/node-structural-information","","level";), 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.INTEGER_TYPE_ONE),
+        FunctionConsts::FN_ZORBA_STRUCT_LEVEL_1);
+
+  }
+
+
+  {
+    
+
+    DECL_WITH_KIND(sctx, fn_zorba_struct_is_attribute,
+        (createQName("http://www.zorba-xquery.com/modules/node-structural-information","","is-attribute";), 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),
+        FunctionConsts::FN_ZORBA_STRUCT_IS_ATTRIBUTE_1);
+
+  }
+
+
+  {
+    
+
+    DECL_WITH_KIND(sctx, fn_zorba_struct_is_comment,
+        (createQName("http://www.zorba-xquery.com/modules/node-structural-information","","is-comment";), 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),
+        FunctionConsts::FN_ZORBA_STRUCT_IS_COMMENT_1);
+
+  }
+
+
+  {
+    
+
+    DECL_WITH_KIND(sctx, fn_zorba_struct_is_document,
+        (createQName("http://www.zorba-xquery.com/modules/node-structural-information","","is-document";), 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),
+        FunctionConsts::FN_ZORBA_STRUCT_IS_DOCUMENT_1);
+
+  }
+
+
+  {
+    
+
+    DECL_WITH_KIND(sctx, fn_zorba_struct_is_element,
+        (createQName("http://www.zorba-xquery.com/modules/node-structural-information","","is-element";), 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),
+        FunctionConsts::FN_ZORBA_STRUCT_IS_ELEMENT_1);
+
+  }
+
+
+  {
+    
+
+    DECL_WITH_KIND(sctx, fn_zorba_struct_is_processing_instruction,
+        (createQName("http://www.zorba-xquery.com/modules/node-structural-information","","is-processing-instruction";), 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),
+        FunctionConsts::FN_ZORBA_STRUCT_IS_PROCESSING_INSTRUCTION_1);
+
+  }
+
+
+  {
+    
+
+    DECL_WITH_KIND(sctx, fn_zorba_struct_is_text,
+        (createQName("http://www.zorba-xquery.com/modules/node-structural-information","","is-text";), 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),
+        FunctionConsts::FN_ZORBA_STRUCT_IS_TEXT_1);
+
+  }
+
+
+  {
+    
+
+    DECL_WITH_KIND(sctx, fn_zorba_struct_sibling_of,
+        (createQName("http://www.zorba-xquery.com/modules/node-structural-information","","sibling-of";), 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),
+        FunctionConsts::FN_ZORBA_STRUCT_SIBLING_OF_2);
+
+  }
+
+
+  {
+    
+
+    DECL_WITH_KIND(sctx, fn_zorba_struct_in_same_tree_of,
+        (createQName("http://www.zorba-xquery.com/modules/node-structural-information","","in-same-tree-of";), 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),
+        FunctionConsts::FN_ZORBA_STRUCT_IN_SAME_TREE_OF_2);
+
+  }
+
+
+  {
+    
+
+    DECL_WITH_KIND(sctx, fn_zorba_struct_in_collection,
+        (createQName("http://www.zorba-xquery.com/modules/node-structural-information","","in-collection";), 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),
+        FunctionConsts::FN_ZORBA_STRUCT_IN_COLLECTION_1);
+
+  }
+
+
+  {
+    
+
+    DECL_WITH_KIND(sctx, fn_zorba_struct_in_same_collection_of,
+        (createQName("http://www.zorba-xquery.com/modules/node-structural-information","","in-same-collection-of";), 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.ANY_URI_TYPE_ONE, 
+        GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),
+        FunctionConsts::FN_ZORBA_STRUCT_IN_SAME_COLLECTION_OF_2);
+
+  }
+
+}
+
+
+}
+
+
+

=== added file 'src/functions/pregenerated/func_structural.h'
--- src/functions/pregenerated/func_structural.h	1970-01-01 00:00:00 +0000
+++ src/functions/pregenerated/func_structural.h	2011-10-06 09:58:24 +0000
@@ -0,0 +1,348 @@
+/*
+ * Copyright 2006-2008 The FLWOR Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+// ******************************************
+// *                                        *
+// * THIS IS A GENERATED FILE. DO NOT EDIT! *
+// * SEE .xml FILE WITH SAME NAME           *
+// *                                        *
+// ******************************************
+
+
+#ifndef ZORBA_FUNCTIONS_STRUCTURAL_H
+#define ZORBA_FUNCTIONS_STRUCTURAL_H
+
+
+#include "common/shared_types.h"
+#include "functions/function_impl.h"
+
+
+namespace zorba {
+
+
+void populate_context_structural(static_context* sctx);
+
+
+
+
+//fn-zorba-struct:node-structural-information
+class fn_zorba_struct_node_structural_information : public function
+{
+public:
+  fn_zorba_struct_node_structural_information(const signature& sig, FunctionConsts::FunctionKind kind)
+    : function(sig, kind) {
+
+}
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-struct:ancestor-of
+class fn_zorba_struct_ancestor_of : public function
+{
+public:
+  fn_zorba_struct_ancestor_of(const signature& sig, FunctionConsts::FunctionKind kind)
+    : function(sig, kind) {
+
+}
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-struct:following-sibling-of
+class fn_zorba_struct_following_sibling_of : public function
+{
+public:
+  fn_zorba_struct_following_sibling_of(const signature& sig, FunctionConsts::FunctionKind kind)
+    : function(sig, kind) {
+
+}
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-struct:following-of
+class fn_zorba_struct_following_of : public function
+{
+public:
+  fn_zorba_struct_following_of(const signature& sig, FunctionConsts::FunctionKind kind)
+    : function(sig, kind) {
+
+}
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-struct:descendant-of
+class fn_zorba_struct_descendant_of : public function
+{
+public:
+  fn_zorba_struct_descendant_of(const signature& sig, FunctionConsts::FunctionKind kind)
+    : function(sig, kind) {
+
+}
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-struct:preceding-sibling-of
+class fn_zorba_struct_preceding_sibling_of : public function
+{
+public:
+  fn_zorba_struct_preceding_sibling_of(const signature& sig, FunctionConsts::FunctionKind kind)
+    : function(sig, kind) {
+
+}
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-struct:preceding-of
+class fn_zorba_struct_preceding_of : public function
+{
+public:
+  fn_zorba_struct_preceding_of(const signature& sig, FunctionConsts::FunctionKind kind)
+    : function(sig, kind) {
+
+}
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-struct:child-of
+class fn_zorba_struct_child_of : public function
+{
+public:
+  fn_zorba_struct_child_of(const signature& sig, FunctionConsts::FunctionKind kind)
+    : function(sig, kind) {
+
+}
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-struct:attribute-of
+class fn_zorba_struct_attribute_of : public function
+{
+public:
+  fn_zorba_struct_attribute_of(const signature& sig, FunctionConsts::FunctionKind kind)
+    : function(sig, kind) {
+
+}
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-struct:parent-of
+class fn_zorba_struct_parent_of : public function
+{
+public:
+  fn_zorba_struct_parent_of(const signature& sig, FunctionConsts::FunctionKind kind)
+    : function(sig, kind) {
+
+}
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-struct:preceding-in-document-order-of
+class fn_zorba_struct_preceding_in_document_order_of : public function
+{
+public:
+  fn_zorba_struct_preceding_in_document_order_of(const signature& sig, FunctionConsts::FunctionKind kind)
+    : function(sig, kind) {
+
+}
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-struct:following-in-document-order-of
+class fn_zorba_struct_following_in_document_order_of : public function
+{
+public:
+  fn_zorba_struct_following_in_document_order_of(const signature& sig, FunctionConsts::FunctionKind kind)
+    : function(sig, kind) {
+
+}
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-struct:level
+class fn_zorba_struct_level : public function
+{
+public:
+  fn_zorba_struct_level(const signature& sig, FunctionConsts::FunctionKind kind)
+    : function(sig, kind) {
+
+}
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-struct:is-attribute
+class fn_zorba_struct_is_attribute : public function
+{
+public:
+  fn_zorba_struct_is_attribute(const signature& sig, FunctionConsts::FunctionKind kind)
+    : function(sig, kind) {
+
+}
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-struct:is-comment
+class fn_zorba_struct_is_comment : public function
+{
+public:
+  fn_zorba_struct_is_comment(const signature& sig, FunctionConsts::FunctionKind kind)
+    : function(sig, kind) {
+
+}
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-struct:is-document
+class fn_zorba_struct_is_document : public function
+{
+public:
+  fn_zorba_struct_is_document(const signature& sig, FunctionConsts::FunctionKind kind)
+    : function(sig, kind) {
+
+}
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-struct:is-element
+class fn_zorba_struct_is_element : public function
+{
+public:
+  fn_zorba_struct_is_element(const signature& sig, FunctionConsts::FunctionKind kind)
+    : function(sig, kind) {
+
+}
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-struct:is-processing-instruction
+class fn_zorba_struct_is_processing_instruction : public function
+{
+public:
+  fn_zorba_struct_is_processing_instruction(const signature& sig, FunctionConsts::FunctionKind kind)
+    : function(sig, kind) {
+
+}
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-struct:is-text
+class fn_zorba_struct_is_text : public function
+{
+public:
+  fn_zorba_struct_is_text(const signature& sig, FunctionConsts::FunctionKind kind)
+    : function(sig, kind) {
+
+}
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-struct:sibling-of
+class fn_zorba_struct_sibling_of : public function
+{
+public:
+  fn_zorba_struct_sibling_of(const signature& sig, FunctionConsts::FunctionKind kind)
+    : function(sig, kind) {
+
+}
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-struct:in-same-tree-of
+class fn_zorba_struct_in_same_tree_of : public function
+{
+public:
+  fn_zorba_struct_in_same_tree_of(const signature& sig, FunctionConsts::FunctionKind kind)
+    : function(sig, kind) {
+
+}
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-struct:in-collection
+class fn_zorba_struct_in_collection : public function
+{
+public:
+  fn_zorba_struct_in_collection(const signature& sig, FunctionConsts::FunctionKind kind)
+    : function(sig, kind) {
+
+}
+
+  CODEGEN_DECL();
+};
+
+
+//fn-zorba-struct:in-same-collection-of
+class fn_zorba_struct_in_same_collection_of : public function
+{
+public:
+  fn_zorba_struct_in_same_collection_of(const signature& sig, FunctionConsts::FunctionKind kind)
+    : function(sig, kind) {
+
+}
+
+  CODEGEN_DECL();
+};
+
+
+} //namespace zorba
+
+
+#endif
+/*
+ * Local variables:
+ * mode: c++
+ * End:
+ */ 

=== modified file 'src/functions/pregenerated/function_enum.h'
--- src/functions/pregenerated/function_enum.h	2011-08-17 20:22:07 +0000
+++ src/functions/pregenerated/function_enum.h	2011-10-06 09:58:24 +0000
@@ -218,6 +218,29 @@
   FN_ZORBA_NODE_PRECEDING_SIBLING_OF_2,
   FN_ZORBA_NODE_LEVEL_1,
   FN_ZORBA_NODE_LEAST_COMMON_ANCESTOR_2,
+  FN_ZORBA_STRUCT_NODE_STRUCTURAL_INFORMATION_1,
+  FN_ZORBA_STRUCT_ANCESTOR_OF_2,
+  FN_ZORBA_STRUCT_FOLLOWING_SIBLING_OF_2,
+  FN_ZORBA_STRUCT_FOLLOWING_OF_2,
+  FN_ZORBA_STRUCT_DESCENDANT_OF_2,
+  FN_ZORBA_STRUCT_PRECEDING_SIBLING_OF_2,
+  FN_ZORBA_STRUCT_PRECEDING_OF_2,
+  FN_ZORBA_STRUCT_CHILD_OF_2,
+  FN_ZORBA_STRUCT_ATTRIBUTE_OF_2,
+  FN_ZORBA_STRUCT_PARENT_OF_2,
+  FN_ZORBA_STRUCT_PRECEDING_IN_DOCUMENT_ORDER_OF_2,
+  FN_ZORBA_STRUCT_FOLLOWING_IN_DOCUMENT_ORDER_OF_2,
+  FN_ZORBA_STRUCT_LEVEL_1,
+  FN_ZORBA_STRUCT_IS_ATTRIBUTE_1,
+  FN_ZORBA_STRUCT_IS_COMMENT_1,
+  FN_ZORBA_STRUCT_IS_DOCUMENT_1,
+  FN_ZORBA_STRUCT_IS_ELEMENT_1,
+  FN_ZORBA_STRUCT_IS_PROCESSING_INSTRUCTION_1,
+  FN_ZORBA_STRUCT_IS_TEXT_1,
+  FN_ZORBA_STRUCT_SIBLING_OF_2,
+  FN_ZORBA_STRUCT_IN_SAME_TREE_OF_2,
+  FN_ZORBA_STRUCT_IN_COLLECTION_1,
+  FN_ZORBA_STRUCT_IN_SAME_COLLECTION_OF_2,
   FN_ABS_1,
   FN_CEILING_1,
   FN_FLOOR_1,

=== added file 'src/runtime/nodes/pregenerated/structural.cpp'
--- src/runtime/nodes/pregenerated/structural.cpp	1970-01-01 00:00:00 +0000
+++ src/runtime/nodes/pregenerated/structural.cpp	2011-10-06 09:58:24 +0000
@@ -0,0 +1,682 @@
+/*
+ * Copyright 2006-2008 The FLWOR Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+// ******************************************
+// *                                        *
+// * THIS IS A GENERATED FILE. DO NOT EDIT! *
+// * SEE .xml FILE WITH SAME NAME           *
+// *                                        *
+// ******************************************
+
+#include "stdafx.h"
+#include "zorbatypes/rchandle.h"
+#include "zorbatypes/zstring.h"
+#include "runtime/visitors/planiter_visitor.h"
+#include "runtime/nodes/structural.h"
+#include "system/globalenv.h"
+
+
+
+namespace zorba {
+
+// <NodeStructuralInformationIterator>
+const char* NodeStructuralInformationIterator::class_name_str = "NodeStructuralInformationIterator";
+NodeStructuralInformationIterator::class_factory<NodeStructuralInformationIterator>
+NodeStructuralInformationIterator::g_class_factory;
+
+const serialization::ClassVersion 
+NodeStructuralInformationIterator::class_versions[] ={{ 1, 0x000905, false}};
+
+const int NodeStructuralInformationIterator::class_versions_count =
+sizeof(NodeStructuralInformationIterator::class_versions)/sizeof(struct serialization::ClassVersion);
+
+void NodeStructuralInformationIterator::accept(PlanIterVisitor& v) const {
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+NodeStructuralInformationIterator::~NodeStructuralInformationIterator() {}
+
+// </NodeStructuralInformationIterator>
+
+
+// <IsAncestorStructuralInformationIterator>
+const char* IsAncestorStructuralInformationIterator::class_name_str = "IsAncestorStructuralInformationIterator";
+IsAncestorStructuralInformationIterator::class_factory<IsAncestorStructuralInformationIterator>
+IsAncestorStructuralInformationIterator::g_class_factory;
+
+const serialization::ClassVersion 
+IsAncestorStructuralInformationIterator::class_versions[] ={{ 1, 0x000905, false}};
+
+const int IsAncestorStructuralInformationIterator::class_versions_count =
+sizeof(IsAncestorStructuralInformationIterator::class_versions)/sizeof(struct serialization::ClassVersion);
+
+void IsAncestorStructuralInformationIterator::accept(PlanIterVisitor& v) const {
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+IsAncestorStructuralInformationIterator::~IsAncestorStructuralInformationIterator() {}
+
+// </IsAncestorStructuralInformationIterator>
+
+
+// <IsFollowingSiblingStructuralInformationIterator>
+const char* IsFollowingSiblingStructuralInformationIterator::class_name_str = "IsFollowingSiblingStructuralInformationIterator";
+IsFollowingSiblingStructuralInformationIterator::class_factory<IsFollowingSiblingStructuralInformationIterator>
+IsFollowingSiblingStructuralInformationIterator::g_class_factory;
+
+const serialization::ClassVersion 
+IsFollowingSiblingStructuralInformationIterator::class_versions[] ={{ 1, 0x000905, false}};
+
+const int IsFollowingSiblingStructuralInformationIterator::class_versions_count =
+sizeof(IsFollowingSiblingStructuralInformationIterator::class_versions)/sizeof(struct serialization::ClassVersion);
+
+void IsFollowingSiblingStructuralInformationIterator::accept(PlanIterVisitor& v) const {
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+IsFollowingSiblingStructuralInformationIterator::~IsFollowingSiblingStructuralInformationIterator() {}
+
+// </IsFollowingSiblingStructuralInformationIterator>
+
+
+// <IsFollowingStructuralInformationIterator>
+const char* IsFollowingStructuralInformationIterator::class_name_str = "IsFollowingStructuralInformationIterator";
+IsFollowingStructuralInformationIterator::class_factory<IsFollowingStructuralInformationIterator>
+IsFollowingStructuralInformationIterator::g_class_factory;
+
+const serialization::ClassVersion 
+IsFollowingStructuralInformationIterator::class_versions[] ={{ 1, 0x000905, false}};
+
+const int IsFollowingStructuralInformationIterator::class_versions_count =
+sizeof(IsFollowingStructuralInformationIterator::class_versions)/sizeof(struct serialization::ClassVersion);
+
+void IsFollowingStructuralInformationIterator::accept(PlanIterVisitor& v) const {
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+IsFollowingStructuralInformationIterator::~IsFollowingStructuralInformationIterator() {}
+
+// </IsFollowingStructuralInformationIterator>
+
+
+// <IsDescendantStructuralInformationIterator>
+const char* IsDescendantStructuralInformationIterator::class_name_str = "IsDescendantStructuralInformationIterator";
+IsDescendantStructuralInformationIterator::class_factory<IsDescendantStructuralInformationIterator>
+IsDescendantStructuralInformationIterator::g_class_factory;
+
+const serialization::ClassVersion 
+IsDescendantStructuralInformationIterator::class_versions[] ={{ 1, 0x000905, false}};
+
+const int IsDescendantStructuralInformationIterator::class_versions_count =
+sizeof(IsDescendantStructuralInformationIterator::class_versions)/sizeof(struct serialization::ClassVersion);
+
+void IsDescendantStructuralInformationIterator::accept(PlanIterVisitor& v) const {
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+IsDescendantStructuralInformationIterator::~IsDescendantStructuralInformationIterator() {}
+
+// </IsDescendantStructuralInformationIterator>
+
+
+// <IsPrecedingSiblingStructuralInformationIterator>
+const char* IsPrecedingSiblingStructuralInformationIterator::class_name_str = "IsPrecedingSiblingStructuralInformationIterator";
+IsPrecedingSiblingStructuralInformationIterator::class_factory<IsPrecedingSiblingStructuralInformationIterator>
+IsPrecedingSiblingStructuralInformationIterator::g_class_factory;
+
+const serialization::ClassVersion 
+IsPrecedingSiblingStructuralInformationIterator::class_versions[] ={{ 1, 0x000905, false}};
+
+const int IsPrecedingSiblingStructuralInformationIterator::class_versions_count =
+sizeof(IsPrecedingSiblingStructuralInformationIterator::class_versions)/sizeof(struct serialization::ClassVersion);
+
+void IsPrecedingSiblingStructuralInformationIterator::accept(PlanIterVisitor& v) const {
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+IsPrecedingSiblingStructuralInformationIterator::~IsPrecedingSiblingStructuralInformationIterator() {}
+
+// </IsPrecedingSiblingStructuralInformationIterator>
+
+
+// <IsPrecedingStructuralInformationIterator>
+const char* IsPrecedingStructuralInformationIterator::class_name_str = "IsPrecedingStructuralInformationIterator";
+IsPrecedingStructuralInformationIterator::class_factory<IsPrecedingStructuralInformationIterator>
+IsPrecedingStructuralInformationIterator::g_class_factory;
+
+const serialization::ClassVersion 
+IsPrecedingStructuralInformationIterator::class_versions[] ={{ 1, 0x000905, false}};
+
+const int IsPrecedingStructuralInformationIterator::class_versions_count =
+sizeof(IsPrecedingStructuralInformationIterator::class_versions)/sizeof(struct serialization::ClassVersion);
+
+void IsPrecedingStructuralInformationIterator::accept(PlanIterVisitor& v) const {
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+IsPrecedingStructuralInformationIterator::~IsPrecedingStructuralInformationIterator() {}
+
+// </IsPrecedingStructuralInformationIterator>
+
+
+// <IsChildStructuralInformationIterator>
+const char* IsChildStructuralInformationIterator::class_name_str = "IsChildStructuralInformationIterator";
+IsChildStructuralInformationIterator::class_factory<IsChildStructuralInformationIterator>
+IsChildStructuralInformationIterator::g_class_factory;
+
+const serialization::ClassVersion 
+IsChildStructuralInformationIterator::class_versions[] ={{ 1, 0x000905, false}};
+
+const int IsChildStructuralInformationIterator::class_versions_count =
+sizeof(IsChildStructuralInformationIterator::class_versions)/sizeof(struct serialization::ClassVersion);
+
+void IsChildStructuralInformationIterator::accept(PlanIterVisitor& v) const {
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+IsChildStructuralInformationIterator::~IsChildStructuralInformationIterator() {}
+
+// </IsChildStructuralInformationIterator>
+
+
+// <IsAttributeOfStructuralInformationIterator>
+const char* IsAttributeOfStructuralInformationIterator::class_name_str = "IsAttributeOfStructuralInformationIterator";
+IsAttributeOfStructuralInformationIterator::class_factory<IsAttributeOfStructuralInformationIterator>
+IsAttributeOfStructuralInformationIterator::g_class_factory;
+
+const serialization::ClassVersion 
+IsAttributeOfStructuralInformationIterator::class_versions[] ={{ 1, 0x000905, false}};
+
+const int IsAttributeOfStructuralInformationIterator::class_versions_count =
+sizeof(IsAttributeOfStructuralInformationIterator::class_versions)/sizeof(struct serialization::ClassVersion);
+
+void IsAttributeOfStructuralInformationIterator::accept(PlanIterVisitor& v) const {
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+IsAttributeOfStructuralInformationIterator::~IsAttributeOfStructuralInformationIterator() {}
+
+// </IsAttributeOfStructuralInformationIterator>
+
+
+// <IsParentStructuralInformationIterator>
+const char* IsParentStructuralInformationIterator::class_name_str = "IsParentStructuralInformationIterator";
+IsParentStructuralInformationIterator::class_factory<IsParentStructuralInformationIterator>
+IsParentStructuralInformationIterator::g_class_factory;
+
+const serialization::ClassVersion 
+IsParentStructuralInformationIterator::class_versions[] ={{ 1, 0x000905, false}};
+
+const int IsParentStructuralInformationIterator::class_versions_count =
+sizeof(IsParentStructuralInformationIterator::class_versions)/sizeof(struct serialization::ClassVersion);
+
+void IsParentStructuralInformationIterator::accept(PlanIterVisitor& v) const {
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+IsParentStructuralInformationIterator::~IsParentStructuralInformationIterator() {}
+
+// </IsParentStructuralInformationIterator>
+
+
+// <IsPrecedingInDocumentOrderStructuralInformationIterator>
+const char* IsPrecedingInDocumentOrderStructuralInformationIterator::class_name_str = "IsPrecedingInDocumentOrderStructuralInformationIterator";
+IsPrecedingInDocumentOrderStructuralInformationIterator::class_factory<IsPrecedingInDocumentOrderStructuralInformationIterator>
+IsPrecedingInDocumentOrderStructuralInformationIterator::g_class_factory;
+
+const serialization::ClassVersion 
+IsPrecedingInDocumentOrderStructuralInformationIterator::class_versions[] ={{ 1, 0x000905, false}};
+
+const int IsPrecedingInDocumentOrderStructuralInformationIterator::class_versions_count =
+sizeof(IsPrecedingInDocumentOrderStructuralInformationIterator::class_versions)/sizeof(struct serialization::ClassVersion);
+
+void IsPrecedingInDocumentOrderStructuralInformationIterator::accept(PlanIterVisitor& v) const {
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+IsPrecedingInDocumentOrderStructuralInformationIterator::~IsPrecedingInDocumentOrderStructuralInformationIterator() {}
+
+// </IsPrecedingInDocumentOrderStructuralInformationIterator>
+
+
+// <IsFollowingInDocumentOrderStructuralInformationIterator>
+const char* IsFollowingInDocumentOrderStructuralInformationIterator::class_name_str = "IsFollowingInDocumentOrderStructuralInformationIterator";
+IsFollowingInDocumentOrderStructuralInformationIterator::class_factory<IsFollowingInDocumentOrderStructuralInformationIterator>
+IsFollowingInDocumentOrderStructuralInformationIterator::g_class_factory;
+
+const serialization::ClassVersion 
+IsFollowingInDocumentOrderStructuralInformationIterator::class_versions[] ={{ 1, 0x000905, false}};
+
+const int IsFollowingInDocumentOrderStructuralInformationIterator::class_versions_count =
+sizeof(IsFollowingInDocumentOrderStructuralInformationIterator::class_versions)/sizeof(struct serialization::ClassVersion);
+
+void IsFollowingInDocumentOrderStructuralInformationIterator::accept(PlanIterVisitor& v) const {
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+IsFollowingInDocumentOrderStructuralInformationIterator::~IsFollowingInDocumentOrderStructuralInformationIterator() {}
+
+// </IsFollowingInDocumentOrderStructuralInformationIterator>
+
+
+// <LevelStructuralInformationIterator>
+const char* LevelStructuralInformationIterator::class_name_str = "LevelStructuralInformationIterator";
+LevelStructuralInformationIterator::class_factory<LevelStructuralInformationIterator>
+LevelStructuralInformationIterator::g_class_factory;
+
+const serialization::ClassVersion 
+LevelStructuralInformationIterator::class_versions[] ={{ 1, 0x000905, false}};
+
+const int LevelStructuralInformationIterator::class_versions_count =
+sizeof(LevelStructuralInformationIterator::class_versions)/sizeof(struct serialization::ClassVersion);
+
+void LevelStructuralInformationIterator::accept(PlanIterVisitor& v) const {
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+LevelStructuralInformationIterator::~LevelStructuralInformationIterator() {}
+
+// </LevelStructuralInformationIterator>
+
+
+// <IsAttributeStructuralInformationIterator>
+const char* IsAttributeStructuralInformationIterator::class_name_str = "IsAttributeStructuralInformationIterator";
+IsAttributeStructuralInformationIterator::class_factory<IsAttributeStructuralInformationIterator>
+IsAttributeStructuralInformationIterator::g_class_factory;
+
+const serialization::ClassVersion 
+IsAttributeStructuralInformationIterator::class_versions[] ={{ 1, 0x000905, false}};
+
+const int IsAttributeStructuralInformationIterator::class_versions_count =
+sizeof(IsAttributeStructuralInformationIterator::class_versions)/sizeof(struct serialization::ClassVersion);
+
+void IsAttributeStructuralInformationIterator::accept(PlanIterVisitor& v) const {
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+IsAttributeStructuralInformationIterator::~IsAttributeStructuralInformationIterator() {}
+
+// </IsAttributeStructuralInformationIterator>
+
+
+// <IsCommentStructuralInformationIterator>
+const char* IsCommentStructuralInformationIterator::class_name_str = "IsCommentStructuralInformationIterator";
+IsCommentStructuralInformationIterator::class_factory<IsCommentStructuralInformationIterator>
+IsCommentStructuralInformationIterator::g_class_factory;
+
+const serialization::ClassVersion 
+IsCommentStructuralInformationIterator::class_versions[] ={{ 1, 0x000905, false}};
+
+const int IsCommentStructuralInformationIterator::class_versions_count =
+sizeof(IsCommentStructuralInformationIterator::class_versions)/sizeof(struct serialization::ClassVersion);
+
+void IsCommentStructuralInformationIterator::accept(PlanIterVisitor& v) const {
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+IsCommentStructuralInformationIterator::~IsCommentStructuralInformationIterator() {}
+
+// </IsCommentStructuralInformationIterator>
+
+
+// <IsDocumentStructuralInformationIterator>
+const char* IsDocumentStructuralInformationIterator::class_name_str = "IsDocumentStructuralInformationIterator";
+IsDocumentStructuralInformationIterator::class_factory<IsDocumentStructuralInformationIterator>
+IsDocumentStructuralInformationIterator::g_class_factory;
+
+const serialization::ClassVersion 
+IsDocumentStructuralInformationIterator::class_versions[] ={{ 1, 0x000905, false}};
+
+const int IsDocumentStructuralInformationIterator::class_versions_count =
+sizeof(IsDocumentStructuralInformationIterator::class_versions)/sizeof(struct serialization::ClassVersion);
+
+void IsDocumentStructuralInformationIterator::accept(PlanIterVisitor& v) const {
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+IsDocumentStructuralInformationIterator::~IsDocumentStructuralInformationIterator() {}
+
+// </IsDocumentStructuralInformationIterator>
+
+
+// <IsElementStructuralInformationIterator>
+const char* IsElementStructuralInformationIterator::class_name_str = "IsElementStructuralInformationIterator";
+IsElementStructuralInformationIterator::class_factory<IsElementStructuralInformationIterator>
+IsElementStructuralInformationIterator::g_class_factory;
+
+const serialization::ClassVersion 
+IsElementStructuralInformationIterator::class_versions[] ={{ 1, 0x000905, false}};
+
+const int IsElementStructuralInformationIterator::class_versions_count =
+sizeof(IsElementStructuralInformationIterator::class_versions)/sizeof(struct serialization::ClassVersion);
+
+void IsElementStructuralInformationIterator::accept(PlanIterVisitor& v) const {
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+IsElementStructuralInformationIterator::~IsElementStructuralInformationIterator() {}
+
+// </IsElementStructuralInformationIterator>
+
+
+// <IsProcessingInstructionStructuralInformationIterator>
+const char* IsProcessingInstructionStructuralInformationIterator::class_name_str = "IsProcessingInstructionStructuralInformationIterator";
+IsProcessingInstructionStructuralInformationIterator::class_factory<IsProcessingInstructionStructuralInformationIterator>
+IsProcessingInstructionStructuralInformationIterator::g_class_factory;
+
+const serialization::ClassVersion 
+IsProcessingInstructionStructuralInformationIterator::class_versions[] ={{ 1, 0x000905, false}};
+
+const int IsProcessingInstructionStructuralInformationIterator::class_versions_count =
+sizeof(IsProcessingInstructionStructuralInformationIterator::class_versions)/sizeof(struct serialization::ClassVersion);
+
+void IsProcessingInstructionStructuralInformationIterator::accept(PlanIterVisitor& v) const {
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+IsProcessingInstructionStructuralInformationIterator::~IsProcessingInstructionStructuralInformationIterator() {}
+
+// </IsProcessingInstructionStructuralInformationIterator>
+
+
+// <IsTextStructuralInformationIterator>
+const char* IsTextStructuralInformationIterator::class_name_str = "IsTextStructuralInformationIterator";
+IsTextStructuralInformationIterator::class_factory<IsTextStructuralInformationIterator>
+IsTextStructuralInformationIterator::g_class_factory;
+
+const serialization::ClassVersion 
+IsTextStructuralInformationIterator::class_versions[] ={{ 1, 0x000905, false}};
+
+const int IsTextStructuralInformationIterator::class_versions_count =
+sizeof(IsTextStructuralInformationIterator::class_versions)/sizeof(struct serialization::ClassVersion);
+
+void IsTextStructuralInformationIterator::accept(PlanIterVisitor& v) const {
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+IsTextStructuralInformationIterator::~IsTextStructuralInformationIterator() {}
+
+// </IsTextStructuralInformationIterator>
+
+
+// <IsSiblingStructuralInformationIterator>
+const char* IsSiblingStructuralInformationIterator::class_name_str = "IsSiblingStructuralInformationIterator";
+IsSiblingStructuralInformationIterator::class_factory<IsSiblingStructuralInformationIterator>
+IsSiblingStructuralInformationIterator::g_class_factory;
+
+const serialization::ClassVersion 
+IsSiblingStructuralInformationIterator::class_versions[] ={{ 1, 0x000905, false}};
+
+const int IsSiblingStructuralInformationIterator::class_versions_count =
+sizeof(IsSiblingStructuralInformationIterator::class_versions)/sizeof(struct serialization::ClassVersion);
+
+void IsSiblingStructuralInformationIterator::accept(PlanIterVisitor& v) const {
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+IsSiblingStructuralInformationIterator::~IsSiblingStructuralInformationIterator() {}
+
+// </IsSiblingStructuralInformationIterator>
+
+
+// <InSameTreeStructuralInformationIterator>
+const char* InSameTreeStructuralInformationIterator::class_name_str = "InSameTreeStructuralInformationIterator";
+InSameTreeStructuralInformationIterator::class_factory<InSameTreeStructuralInformationIterator>
+InSameTreeStructuralInformationIterator::g_class_factory;
+
+const serialization::ClassVersion 
+InSameTreeStructuralInformationIterator::class_versions[] ={{ 1, 0x000905, false}};
+
+const int InSameTreeStructuralInformationIterator::class_versions_count =
+sizeof(InSameTreeStructuralInformationIterator::class_versions)/sizeof(struct serialization::ClassVersion);
+
+void InSameTreeStructuralInformationIterator::accept(PlanIterVisitor& v) const {
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+InSameTreeStructuralInformationIterator::~InSameTreeStructuralInformationIterator() {}
+
+// </InSameTreeStructuralInformationIterator>
+
+
+// <InCollectionStructuralInformationIterator>
+const char* InCollectionStructuralInformationIterator::class_name_str = "InCollectionStructuralInformationIterator";
+InCollectionStructuralInformationIterator::class_factory<InCollectionStructuralInformationIterator>
+InCollectionStructuralInformationIterator::g_class_factory;
+
+const serialization::ClassVersion 
+InCollectionStructuralInformationIterator::class_versions[] ={{ 1, 0x000905, false}};
+
+const int InCollectionStructuralInformationIterator::class_versions_count =
+sizeof(InCollectionStructuralInformationIterator::class_versions)/sizeof(struct serialization::ClassVersion);
+
+void InCollectionStructuralInformationIterator::accept(PlanIterVisitor& v) const {
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+InCollectionStructuralInformationIterator::~InCollectionStructuralInformationIterator() {}
+
+// </InCollectionStructuralInformationIterator>
+
+
+// <InSameCollectionStructuralInformationIterator>
+const char* InSameCollectionStructuralInformationIterator::class_name_str = "InSameCollectionStructuralInformationIterator";
+InSameCollectionStructuralInformationIterator::class_factory<InSameCollectionStructuralInformationIterator>
+InSameCollectionStructuralInformationIterator::g_class_factory;
+
+const serialization::ClassVersion 
+InSameCollectionStructuralInformationIterator::class_versions[] ={{ 1, 0x000905, false}};
+
+const int InSameCollectionStructuralInformationIterator::class_versions_count =
+sizeof(InSameCollectionStructuralInformationIterator::class_versions)/sizeof(struct serialization::ClassVersion);
+
+void InSameCollectionStructuralInformationIterator::accept(PlanIterVisitor& v) const {
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+InSameCollectionStructuralInformationIterator::~InSameCollectionStructuralInformationIterator() {}
+
+// </InSameCollectionStructuralInformationIterator>
+
+
+
+}
+
+

=== added file 'src/runtime/nodes/pregenerated/structural.h'
--- src/runtime/nodes/pregenerated/structural.h	1970-01-01 00:00:00 +0000
+++ src/runtime/nodes/pregenerated/structural.h	2011-10-06 09:58:24 +0000
@@ -0,0 +1,826 @@
+/*
+ * Copyright 2006-2008 The FLWOR Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+// ******************************************
+// *                                        *
+// * THIS IS A GENERATED FILE. DO NOT EDIT! *
+// * SEE .xml FILE WITH SAME NAME           *
+// *                                        *
+// ******************************************
+#ifndef ZORBA_RUNTIME_NODES_STRUCTURAL_H
+#define ZORBA_RUNTIME_NODES_STRUCTURAL_H
+
+
+#include "common/shared_types.h"
+
+
+
+#include "runtime/base/narybase.h"
+
+
+namespace zorba {
+
+/**
+ * 
+ *  Iterator to implement the zorba:node-reference function.
+ *  
+ * Author: Federico Cavalieri
+ */
+class NodeStructuralInformationIterator : public NaryBaseIterator<NodeStructuralInformationIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(NodeStructuralInformationIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(NodeStructuralInformationIterator,
+    NaryBaseIterator<NodeStructuralInformationIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar)
+  {
+    serialize_baseclass(ar,
+    (NaryBaseIterator<NodeStructuralInformationIterator, PlanIteratorState>*)this);
+  }
+
+  NodeStructuralInformationIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<NodeStructuralInformationIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~NodeStructuralInformationIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: Federico Cavalieri
+ */
+class IsAncestorStructuralInformationIterator : public NaryBaseIterator<IsAncestorStructuralInformationIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(IsAncestorStructuralInformationIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(IsAncestorStructuralInformationIterator,
+    NaryBaseIterator<IsAncestorStructuralInformationIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar)
+  {
+    serialize_baseclass(ar,
+    (NaryBaseIterator<IsAncestorStructuralInformationIterator, PlanIteratorState>*)this);
+  }
+
+  IsAncestorStructuralInformationIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<IsAncestorStructuralInformationIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~IsAncestorStructuralInformationIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: Federico Cavalieri
+ */
+class IsFollowingSiblingStructuralInformationIterator : public NaryBaseIterator<IsFollowingSiblingStructuralInformationIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(IsFollowingSiblingStructuralInformationIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(IsFollowingSiblingStructuralInformationIterator,
+    NaryBaseIterator<IsFollowingSiblingStructuralInformationIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar)
+  {
+    serialize_baseclass(ar,
+    (NaryBaseIterator<IsFollowingSiblingStructuralInformationIterator, PlanIteratorState>*)this);
+  }
+
+  IsFollowingSiblingStructuralInformationIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<IsFollowingSiblingStructuralInformationIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~IsFollowingSiblingStructuralInformationIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: Federico Cavalieri
+ */
+class IsFollowingStructuralInformationIterator : public NaryBaseIterator<IsFollowingStructuralInformationIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(IsFollowingStructuralInformationIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(IsFollowingStructuralInformationIterator,
+    NaryBaseIterator<IsFollowingStructuralInformationIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar)
+  {
+    serialize_baseclass(ar,
+    (NaryBaseIterator<IsFollowingStructuralInformationIterator, PlanIteratorState>*)this);
+  }
+
+  IsFollowingStructuralInformationIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<IsFollowingStructuralInformationIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~IsFollowingStructuralInformationIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: Federico Cavalieri
+ */
+class IsDescendantStructuralInformationIterator : public NaryBaseIterator<IsDescendantStructuralInformationIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(IsDescendantStructuralInformationIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(IsDescendantStructuralInformationIterator,
+    NaryBaseIterator<IsDescendantStructuralInformationIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar)
+  {
+    serialize_baseclass(ar,
+    (NaryBaseIterator<IsDescendantStructuralInformationIterator, PlanIteratorState>*)this);
+  }
+
+  IsDescendantStructuralInformationIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<IsDescendantStructuralInformationIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~IsDescendantStructuralInformationIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: Federico Cavalieri
+ */
+class IsPrecedingSiblingStructuralInformationIterator : public NaryBaseIterator<IsPrecedingSiblingStructuralInformationIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(IsPrecedingSiblingStructuralInformationIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(IsPrecedingSiblingStructuralInformationIterator,
+    NaryBaseIterator<IsPrecedingSiblingStructuralInformationIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar)
+  {
+    serialize_baseclass(ar,
+    (NaryBaseIterator<IsPrecedingSiblingStructuralInformationIterator, PlanIteratorState>*)this);
+  }
+
+  IsPrecedingSiblingStructuralInformationIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<IsPrecedingSiblingStructuralInformationIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~IsPrecedingSiblingStructuralInformationIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: Federico Cavalieri
+ */
+class IsPrecedingStructuralInformationIterator : public NaryBaseIterator<IsPrecedingStructuralInformationIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(IsPrecedingStructuralInformationIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(IsPrecedingStructuralInformationIterator,
+    NaryBaseIterator<IsPrecedingStructuralInformationIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar)
+  {
+    serialize_baseclass(ar,
+    (NaryBaseIterator<IsPrecedingStructuralInformationIterator, PlanIteratorState>*)this);
+  }
+
+  IsPrecedingStructuralInformationIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<IsPrecedingStructuralInformationIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~IsPrecedingStructuralInformationIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: Federico Cavalieri
+ */
+class IsChildStructuralInformationIterator : public NaryBaseIterator<IsChildStructuralInformationIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(IsChildStructuralInformationIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(IsChildStructuralInformationIterator,
+    NaryBaseIterator<IsChildStructuralInformationIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar)
+  {
+    serialize_baseclass(ar,
+    (NaryBaseIterator<IsChildStructuralInformationIterator, PlanIteratorState>*)this);
+  }
+
+  IsChildStructuralInformationIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<IsChildStructuralInformationIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~IsChildStructuralInformationIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: Federico Cavalieri
+ */
+class IsAttributeOfStructuralInformationIterator : public NaryBaseIterator<IsAttributeOfStructuralInformationIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(IsAttributeOfStructuralInformationIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(IsAttributeOfStructuralInformationIterator,
+    NaryBaseIterator<IsAttributeOfStructuralInformationIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar)
+  {
+    serialize_baseclass(ar,
+    (NaryBaseIterator<IsAttributeOfStructuralInformationIterator, PlanIteratorState>*)this);
+  }
+
+  IsAttributeOfStructuralInformationIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<IsAttributeOfStructuralInformationIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~IsAttributeOfStructuralInformationIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: Federico Cavalieri
+ */
+class IsParentStructuralInformationIterator : public NaryBaseIterator<IsParentStructuralInformationIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(IsParentStructuralInformationIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(IsParentStructuralInformationIterator,
+    NaryBaseIterator<IsParentStructuralInformationIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar)
+  {
+    serialize_baseclass(ar,
+    (NaryBaseIterator<IsParentStructuralInformationIterator, PlanIteratorState>*)this);
+  }
+
+  IsParentStructuralInformationIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<IsParentStructuralInformationIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~IsParentStructuralInformationIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: Federico Cavalieri
+ */
+class IsPrecedingInDocumentOrderStructuralInformationIterator : public NaryBaseIterator<IsPrecedingInDocumentOrderStructuralInformationIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(IsPrecedingInDocumentOrderStructuralInformationIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(IsPrecedingInDocumentOrderStructuralInformationIterator,
+    NaryBaseIterator<IsPrecedingInDocumentOrderStructuralInformationIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar)
+  {
+    serialize_baseclass(ar,
+    (NaryBaseIterator<IsPrecedingInDocumentOrderStructuralInformationIterator, PlanIteratorState>*)this);
+  }
+
+  IsPrecedingInDocumentOrderStructuralInformationIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<IsPrecedingInDocumentOrderStructuralInformationIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~IsPrecedingInDocumentOrderStructuralInformationIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: Federico Cavalieri
+ */
+class IsFollowingInDocumentOrderStructuralInformationIterator : public NaryBaseIterator<IsFollowingInDocumentOrderStructuralInformationIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(IsFollowingInDocumentOrderStructuralInformationIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(IsFollowingInDocumentOrderStructuralInformationIterator,
+    NaryBaseIterator<IsFollowingInDocumentOrderStructuralInformationIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar)
+  {
+    serialize_baseclass(ar,
+    (NaryBaseIterator<IsFollowingInDocumentOrderStructuralInformationIterator, PlanIteratorState>*)this);
+  }
+
+  IsFollowingInDocumentOrderStructuralInformationIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<IsFollowingInDocumentOrderStructuralInformationIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~IsFollowingInDocumentOrderStructuralInformationIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: Federico Cavalieri
+ */
+class LevelStructuralInformationIterator : public NaryBaseIterator<LevelStructuralInformationIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(LevelStructuralInformationIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(LevelStructuralInformationIterator,
+    NaryBaseIterator<LevelStructuralInformationIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar)
+  {
+    serialize_baseclass(ar,
+    (NaryBaseIterator<LevelStructuralInformationIterator, PlanIteratorState>*)this);
+  }
+
+  LevelStructuralInformationIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<LevelStructuralInformationIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~LevelStructuralInformationIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: Federico Cavalieri
+ */
+class IsAttributeStructuralInformationIterator : public NaryBaseIterator<IsAttributeStructuralInformationIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(IsAttributeStructuralInformationIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(IsAttributeStructuralInformationIterator,
+    NaryBaseIterator<IsAttributeStructuralInformationIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar)
+  {
+    serialize_baseclass(ar,
+    (NaryBaseIterator<IsAttributeStructuralInformationIterator, PlanIteratorState>*)this);
+  }
+
+  IsAttributeStructuralInformationIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<IsAttributeStructuralInformationIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~IsAttributeStructuralInformationIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: Federico Cavalieri
+ */
+class IsCommentStructuralInformationIterator : public NaryBaseIterator<IsCommentStructuralInformationIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(IsCommentStructuralInformationIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(IsCommentStructuralInformationIterator,
+    NaryBaseIterator<IsCommentStructuralInformationIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar)
+  {
+    serialize_baseclass(ar,
+    (NaryBaseIterator<IsCommentStructuralInformationIterator, PlanIteratorState>*)this);
+  }
+
+  IsCommentStructuralInformationIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<IsCommentStructuralInformationIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~IsCommentStructuralInformationIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: Federico Cavalieri
+ */
+class IsDocumentStructuralInformationIterator : public NaryBaseIterator<IsDocumentStructuralInformationIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(IsDocumentStructuralInformationIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(IsDocumentStructuralInformationIterator,
+    NaryBaseIterator<IsDocumentStructuralInformationIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar)
+  {
+    serialize_baseclass(ar,
+    (NaryBaseIterator<IsDocumentStructuralInformationIterator, PlanIteratorState>*)this);
+  }
+
+  IsDocumentStructuralInformationIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<IsDocumentStructuralInformationIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~IsDocumentStructuralInformationIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: Federico Cavalieri
+ */
+class IsElementStructuralInformationIterator : public NaryBaseIterator<IsElementStructuralInformationIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(IsElementStructuralInformationIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(IsElementStructuralInformationIterator,
+    NaryBaseIterator<IsElementStructuralInformationIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar)
+  {
+    serialize_baseclass(ar,
+    (NaryBaseIterator<IsElementStructuralInformationIterator, PlanIteratorState>*)this);
+  }
+
+  IsElementStructuralInformationIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<IsElementStructuralInformationIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~IsElementStructuralInformationIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: Federico Cavalieri
+ */
+class IsProcessingInstructionStructuralInformationIterator : public NaryBaseIterator<IsProcessingInstructionStructuralInformationIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(IsProcessingInstructionStructuralInformationIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(IsProcessingInstructionStructuralInformationIterator,
+    NaryBaseIterator<IsProcessingInstructionStructuralInformationIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar)
+  {
+    serialize_baseclass(ar,
+    (NaryBaseIterator<IsProcessingInstructionStructuralInformationIterator, PlanIteratorState>*)this);
+  }
+
+  IsProcessingInstructionStructuralInformationIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<IsProcessingInstructionStructuralInformationIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~IsProcessingInstructionStructuralInformationIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: Federico Cavalieri
+ */
+class IsTextStructuralInformationIterator : public NaryBaseIterator<IsTextStructuralInformationIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(IsTextStructuralInformationIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(IsTextStructuralInformationIterator,
+    NaryBaseIterator<IsTextStructuralInformationIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar)
+  {
+    serialize_baseclass(ar,
+    (NaryBaseIterator<IsTextStructuralInformationIterator, PlanIteratorState>*)this);
+  }
+
+  IsTextStructuralInformationIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<IsTextStructuralInformationIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~IsTextStructuralInformationIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: Federico Cavalieri
+ */
+class IsSiblingStructuralInformationIterator : public NaryBaseIterator<IsSiblingStructuralInformationIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(IsSiblingStructuralInformationIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(IsSiblingStructuralInformationIterator,
+    NaryBaseIterator<IsSiblingStructuralInformationIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar)
+  {
+    serialize_baseclass(ar,
+    (NaryBaseIterator<IsSiblingStructuralInformationIterator, PlanIteratorState>*)this);
+  }
+
+  IsSiblingStructuralInformationIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<IsSiblingStructuralInformationIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~IsSiblingStructuralInformationIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: Federico Cavalieri
+ */
+class InSameTreeStructuralInformationIterator : public NaryBaseIterator<InSameTreeStructuralInformationIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(InSameTreeStructuralInformationIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(InSameTreeStructuralInformationIterator,
+    NaryBaseIterator<InSameTreeStructuralInformationIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar)
+  {
+    serialize_baseclass(ar,
+    (NaryBaseIterator<InSameTreeStructuralInformationIterator, PlanIteratorState>*)this);
+  }
+
+  InSameTreeStructuralInformationIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<InSameTreeStructuralInformationIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~InSameTreeStructuralInformationIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: Federico Cavalieri
+ */
+class InCollectionStructuralInformationIterator : public NaryBaseIterator<InCollectionStructuralInformationIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(InCollectionStructuralInformationIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(InCollectionStructuralInformationIterator,
+    NaryBaseIterator<InCollectionStructuralInformationIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar)
+  {
+    serialize_baseclass(ar,
+    (NaryBaseIterator<InCollectionStructuralInformationIterator, PlanIteratorState>*)this);
+  }
+
+  InCollectionStructuralInformationIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<InCollectionStructuralInformationIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~InCollectionStructuralInformationIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ * 
+ * Author: Federico Cavalieri
+ */
+class InSameCollectionStructuralInformationIterator : public NaryBaseIterator<InSameCollectionStructuralInformationIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(InSameCollectionStructuralInformationIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(InSameCollectionStructuralInformationIterator,
+    NaryBaseIterator<InSameCollectionStructuralInformationIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar)
+  {
+    serialize_baseclass(ar,
+    (NaryBaseIterator<InSameCollectionStructuralInformationIterator, PlanIteratorState>*)this);
+  }
+
+  InSameCollectionStructuralInformationIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<InSameCollectionStructuralInformationIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~InSameCollectionStructuralInformationIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+}
+#endif
+/*
+ * Local variables:
+ * mode: c++
+ * End:
+ */ 

=== added file 'src/runtime/nodes/structural_impl.cpp'
--- src/runtime/nodes/structural_impl.cpp	1970-01-01 00:00:00 +0000
+++ src/runtime/nodes/structural_impl.cpp	2011-10-06 09:58:24 +0000
@@ -0,0 +1,526 @@
+/*
+ * Copyright 2006-2008 The FLWOR Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "stdafx.h"
+
+#include "runtime/nodes/structural.h"
+#include "zorbamisc/ns_consts.h"
+
+#include "system/globalenv.h"
+
+#include "store/api/item.h"
+#include "store/api/iterator.h"
+#include "store/api/item_factory.h"
+#include "store/api/store.h"
+#include "store/naive/atomic_items.h"
+#include "store/naive/ordpath.h"
+
+#include "util/string_util.h"
+#include "util/uri_util.h"
+#include "zorbautils/string_util.h"
+
+using namespace std;
+
+namespace zorba {
+
+/*******************************************************************************
+ ********************************************************************************/
+bool NodeStructuralInformationIterator::nextImpl(store::Item_t& result, PlanState& planState) const
+{
+  PlanIteratorState *state;
+  bool valid;
+  store::Item_t inNode;
+  DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
+
+  valid = consumeNext(inNode, theChildren[0], planState);
+  assert(valid);
+
+  STACK_PUSH(GENV_STORE.getStructuralInformation(result, inNode), state);
+  STACK_END(state);
+}
+
+/*******************************************************************************
+ ********************************************************************************/
+bool
+IsAncestorStructuralInformationIterator::nextImpl(store::Item_t& result, PlanState& planState) const
+{
+  store::Item_t lUriA;
+  store::Item_t lUriB;
+
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
+
+  consumeNext(lUriA, theChildren[0].getp(), planState);
+  consumeNext(lUriB, theChildren[1].getp(), planState);
+
+
+  STACK_PUSH(
+      GENV_ITEMFACTORY->createBoolean(result,
+          lUriA->isAncestor(lUriB)
+      ), state);
+
+  STACK_END (state);
+}
+
+/*******************************************************************************
+ ********************************************************************************/
+bool
+IsFollowingSiblingStructuralInformationIterator::nextImpl(store::Item_t& result, PlanState& planState) const
+{
+  store::Item_t lUriA;
+  store::Item_t lUriB;
+
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
+
+  consumeNext(lUriA, theChildren[0].getp(), planState);
+  consumeNext(lUriB, theChildren[1].getp(), planState);
+
+
+  STACK_PUSH(
+      GENV_ITEMFACTORY->createBoolean(result,
+          lUriA->isFollowingSibling(lUriB)
+      ), state);
+
+  STACK_END (state);
+}
+
+/*******************************************************************************
+ ********************************************************************************/
+bool
+IsFollowingStructuralInformationIterator::nextImpl(store::Item_t& result, PlanState& planState) const
+{
+  store::Item_t lUriA;
+  store::Item_t lUriB;
+
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
+
+  consumeNext(lUriA, theChildren[0].getp(), planState);
+  consumeNext(lUriB, theChildren[1].getp(), planState);
+
+  STACK_PUSH(
+      GENV_ITEMFACTORY->createBoolean(result,
+          lUriA->isFollowing(lUriB)
+      ), state);
+
+  STACK_END (state);
+}
+
+/*******************************************************************************
+ ********************************************************************************/
+bool
+IsDescendantStructuralInformationIterator::nextImpl(store::Item_t& result, PlanState& planState) const
+{
+  store::Item_t lUriA;
+  store::Item_t lUriB;
+
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
+
+  consumeNext(lUriA, theChildren[0].getp(), planState);
+  consumeNext(lUriB, theChildren[1].getp(), planState);
+
+  STACK_PUSH(
+      GENV_ITEMFACTORY->createBoolean(result,
+          lUriA->isDescendant(lUriB)
+      ), state);
+
+  STACK_END (state);
+}
+
+/*******************************************************************************
+ ********************************************************************************/
+bool
+IsPrecedingSiblingStructuralInformationIterator::nextImpl(store::Item_t& result, PlanState& planState) const
+{
+  store::Item_t lUriA;
+  store::Item_t lUriB;
+
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
+
+  consumeNext(lUriA, theChildren[0].getp(), planState);
+  consumeNext(lUriB, theChildren[1].getp(), planState);
+
+  STACK_PUSH(
+      GENV_ITEMFACTORY->createBoolean(result,
+          lUriA->isPrecedingSibling(lUriB)
+      ), state);
+
+  STACK_END (state);
+}
+
+/*******************************************************************************
+ ********************************************************************************/
+bool
+IsPrecedingStructuralInformationIterator::nextImpl(store::Item_t& result, PlanState& planState) const
+{
+  store::Item_t lUriA;
+  store::Item_t lUriB;
+
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
+
+  consumeNext(lUriA, theChildren[0].getp(), planState);
+  consumeNext(lUriB, theChildren[1].getp(), planState);
+
+  STACK_PUSH(
+      GENV_ITEMFACTORY->createBoolean(result,
+          lUriA->isPreceding(lUriB)
+      ), state);
+
+  STACK_END (state);
+}
+
+/*******************************************************************************
+ ********************************************************************************/
+bool
+IsChildStructuralInformationIterator::nextImpl(store::Item_t& result, PlanState& planState) const
+{
+  store::Item_t lUriA;
+  store::Item_t lUriB;
+
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
+
+  consumeNext(lUriA, theChildren[0].getp(), planState);
+  consumeNext(lUriB, theChildren[1].getp(), planState);
+
+  STACK_PUSH(
+      GENV_ITEMFACTORY->createBoolean(result,
+          lUriA->isChild(lUriB)
+      ), state);
+
+  STACK_END (state);
+}
+
+/*******************************************************************************
+ ********************************************************************************/
+bool
+IsAttributeOfStructuralInformationIterator::nextImpl(store::Item_t& result, PlanState& planState) const
+{
+  store::Item_t lUriA;
+  store::Item_t lUriB;
+
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
+
+  consumeNext(lUriA, theChildren[0].getp(), planState);
+  consumeNext(lUriB, theChildren[1].getp(), planState);
+
+  STACK_PUSH(
+      GENV_ITEMFACTORY->createBoolean(result,
+          lUriA->isAttribute(lUriB)
+      ), state);
+
+  STACK_END (state);
+}
+
+
+/*******************************************************************************
+ ********************************************************************************/
+bool
+IsParentStructuralInformationIterator::nextImpl(store::Item_t& result, PlanState& planState) const
+{
+  store::Item_t lUriA;
+  store::Item_t lUriB;
+
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
+
+  consumeNext(lUriA, theChildren[0].getp(), planState);
+  consumeNext(lUriB, theChildren[1].getp(), planState);
+
+  STACK_PUSH(
+      GENV_ITEMFACTORY->createBoolean(result,
+          lUriA->isParent(lUriB)
+      ), state);
+
+  STACK_END (state);
+}
+
+/*******************************************************************************
+ ********************************************************************************/
+bool
+IsPrecedingInDocumentOrderStructuralInformationIterator::nextImpl(store::Item_t& result, PlanState& planState) const
+{
+  store::Item_t lUriA;
+  store::Item_t lUriB;
+
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
+
+  consumeNext(lUriA, theChildren[0].getp(), planState);
+  consumeNext(lUriB, theChildren[1].getp(), planState);
+
+  STACK_PUSH(
+      GENV_ITEMFACTORY->createBoolean(result,
+          lUriA->isPrecedingInDocumentOrder(lUriB)
+      ), state);
+
+  STACK_END (state);
+}
+
+/*******************************************************************************
+ ********************************************************************************/
+bool
+IsFollowingInDocumentOrderStructuralInformationIterator::nextImpl(store::Item_t& result, PlanState& planState) const
+{
+  store::Item_t lUriA;
+  store::Item_t lUriB;
+
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
+
+  consumeNext(lUriA, theChildren[0].getp(), planState);
+  consumeNext(lUriB, theChildren[1].getp(), planState);
+
+  STACK_PUSH(
+      GENV_ITEMFACTORY->createBoolean(result,
+          lUriA->isFollowingInDocumentOrder(lUriB)
+      ), state);
+
+  STACK_END (state);
+}
+
+/*******************************************************************************
+ ********************************************************************************/
+bool
+LevelStructuralInformationIterator::nextImpl(store::Item_t& result, PlanState& planState) const
+{
+  store::Item_t lUri;
+
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
+
+  consumeNext(lUri, theChildren[0].getp(), planState);
+
+  result=lUri->getLevel();
+  STACK_PUSH(true, state);
+
+  STACK_END (state);
+}
+
+
+/*******************************************************************************
+ ********************************************************************************/
+bool
+IsAttributeStructuralInformationIterator::nextImpl(store::Item_t& result, PlanState& planState) const
+{
+  store::Item_t lUri;
+
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
+
+  consumeNext(lUri, theChildren[0].getp(), planState);
+
+  STACK_PUSH(
+      GENV_ITEMFACTORY->createBoolean(result,
+          lUri->isAttribute()
+      ), state);
+
+  STACK_END (state);
+}
+
+/*******************************************************************************
+ ********************************************************************************/
+bool
+IsCommentStructuralInformationIterator::nextImpl(store::Item_t& result, PlanState& planState) const
+{
+  store::Item_t lUri;
+
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
+
+  consumeNext(lUri, theChildren[0].getp(), planState);
+
+  STACK_PUSH(
+      GENV_ITEMFACTORY->createBoolean(result,
+          lUri->isComment()
+      ), state);
+
+  STACK_END (state);
+}
+
+/*******************************************************************************
+ ********************************************************************************/
+bool
+IsDocumentStructuralInformationIterator::nextImpl(store::Item_t& result, PlanState& planState) const
+{
+  store::Item_t lUri;
+
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
+
+  consumeNext(lUri, theChildren[0].getp(), planState);
+
+  STACK_PUSH(
+      GENV_ITEMFACTORY->createBoolean(result,
+          lUri->isDocument()
+      ), state);
+
+  STACK_END (state);
+}
+
+/*******************************************************************************
+ ********************************************************************************/
+bool
+IsElementStructuralInformationIterator::nextImpl(store::Item_t& result, PlanState& planState) const
+{
+  store::Item_t lUri;
+
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
+
+  consumeNext(lUri, theChildren[0].getp(), planState);
+
+  STACK_PUSH(
+      GENV_ITEMFACTORY->createBoolean(result,
+          lUri->isElement()
+      ), state);
+
+  STACK_END (state);
+}
+
+/*******************************************************************************
+ ********************************************************************************/
+bool
+IsProcessingInstructionStructuralInformationIterator::nextImpl(store::Item_t& result, PlanState& planState) const
+{
+  store::Item_t lUri;
+
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
+
+  consumeNext(lUri, theChildren[0].getp(), planState);
+
+  STACK_PUSH(
+      GENV_ITEMFACTORY->createBoolean(result,
+          lUri->isProcessingInstruction()
+      ), state);
+
+  STACK_END (state);
+}
+
+/*******************************************************************************
+ ********************************************************************************/
+bool
+IsTextStructuralInformationIterator::nextImpl(store::Item_t& result, PlanState& planState) const
+{
+  store::Item_t lUri;
+
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
+
+  consumeNext(lUri, theChildren[0].getp(), planState);
+
+  STACK_PUSH(
+      GENV_ITEMFACTORY->createBoolean(result,
+          lUri->isText()
+      ), state);
+
+  STACK_END (state);
+}
+/*******************************************************************************
+ ********************************************************************************/
+bool
+IsSiblingStructuralInformationIterator::nextImpl(store::Item_t& result, PlanState& planState) const
+{
+  store::Item_t lUriA;
+  store::Item_t lUriB;
+
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
+
+  consumeNext(lUriA, theChildren[0].getp(), planState);
+  consumeNext(lUriB, theChildren[1].getp(), planState);
+
+  STACK_PUSH(
+      GENV_ITEMFACTORY->createBoolean(result,
+          lUriA->isSibling(lUriB)
+      ), state);
+
+  STACK_END (state);
+}
+
+
+/*******************************************************************************
+ ********************************************************************************/
+bool
+InSameTreeStructuralInformationIterator::nextImpl(store::Item_t& result, PlanState& planState) const
+{
+  store::Item_t lUriA;
+  store::Item_t lUriB;
+
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
+
+  consumeNext(lUriA, theChildren[0].getp(), planState);
+  consumeNext(lUriB, theChildren[1].getp(), planState);
+
+  STACK_PUSH(
+      GENV_ITEMFACTORY->createBoolean(result,
+          lUriA->inSameTree(lUriB)
+      ), state);
+
+  STACK_END (state);
+}
+
+/*******************************************************************************
+ ********************************************************************************/
+bool
+InCollectionStructuralInformationIterator::nextImpl(store::Item_t& result, PlanState& planState) const
+{
+  store::Item_t lUri;
+
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
+
+  consumeNext(lUri, theChildren[0].getp(), planState);
+
+  STACK_PUSH(
+      GENV_ITEMFACTORY->createBoolean(result,
+          lUri->inCollection()
+      ), state);
+
+  STACK_END (state);
+}
+
+/*******************************************************************************
+ ********************************************************************************/
+bool
+InSameCollectionStructuralInformationIterator::nextImpl(store::Item_t& result, PlanState& planState) const
+{
+  store::Item_t lUriA;
+  store::Item_t lUriB;
+
+  PlanIteratorState *state;
+  DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
+
+  consumeNext(lUriA, theChildren[0].getp(), planState);
+  consumeNext(lUriB, theChildren[1].getp(), planState);
+
+  STACK_PUSH(
+      GENV_ITEMFACTORY->createBoolean(result,
+          lUriA->inSameCollection(lUriB)
+      ), state);
+
+  STACK_END (state);
+}
+
+} // namespace zorba
+/* vim:set et sw=2 ts=2: */
+

=== modified file 'src/runtime/spec/mappings.xml'
--- src/runtime/spec/mappings.xml	2011-07-26 21:03:39 +0000
+++ src/runtime/spec/mappings.xml	2011-10-06 09:58:24 +0000
@@ -22,7 +22,11 @@
 
     <zorba:namespace uri="http://www.zorba-xquery.com/modules/node-reference";
                      define="ZORBA_NODEREF_FN_NS"
-                     prefix="fn-zorba-ref"/> 
+                     prefix="fn-zorba-ref"/>
+    
+    <zorba:namespace uri="http://www.zorba-xquery.com/modules/node-structural-information";
+                     define="ZORBA_NODESTRUCT_FN_NS"
+                     prefix="fn-zorba-struct"/> 
 
     <zorba:namespace uri="http://www.zorba-xquery.com/modules/schema";
                      define="ZORBA_SCHEMA_FN_NS"

=== added file 'src/runtime/spec/nodes/structural.xml'
--- src/runtime/spec/nodes/structural.xml	1970-01-01 00:00:00 +0000
+++ src/runtime/spec/nodes/structural.xml	2011-10-06 09:58:24 +0000
@@ -0,0 +1,421 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+/////////////////////////////////////////////////////////////////////////////////
+//                                                                             //
+/////////////////////////////////////////////////////////////////////////////////
+-->
+<zorba:iterators
+  xmlns:zorba="http://www.zorba-xquery.com";
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  xsi:schemaLocation="http://www.zorba-xquery.com ../runtime.xsd">
+
+  <!--
+/*******************************************************************************
+********************************************************************************/
+-->
+<zorba:iterator name="NodeStructuralInformationIterator">
+
+  <zorba:description author="Federico Cavalieri">
+  Iterator to implement the zorba:node-reference function.
+  </zorba:description>
+
+  <zorba:function>
+    <zorba:signature localname="node-structural-information" prefix="fn-zorba-struct">
+      <zorba:param>node()</zorba:param>
+      <zorba:output>xs:anyURI</zorba:output>
+    </zorba:signature>
+  </zorba:function>
+
+</zorba:iterator>
+   
+  <!--
+/*******************************************************************************
+********************************************************************************/
+-->
+  <zorba:iterator name="IsAncestorStructuralInformationIterator">
+
+    <zorba:description author="Federico Cavalieri"></zorba:description>
+
+    <zorba:function>
+      <zorba:signature localname="ancestor-of" prefix="fn-zorba-struct">
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:output>xs:boolean</zorba:output>
+      </zorba:signature>
+    </zorba:function>
+
+  </zorba:iterator>
+
+  <!--
+/*******************************************************************************
+********************************************************************************/
+-->
+  <zorba:iterator name="IsFollowingSiblingStructuralInformationIterator">
+
+    <zorba:description author="Federico Cavalieri"></zorba:description>
+
+    <zorba:function>
+      <zorba:signature localname="following-sibling-of" prefix="fn-zorba-struct">
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:output>xs:boolean</zorba:output>
+      </zorba:signature>
+    </zorba:function>
+
+  </zorba:iterator>
+
+<!--
+/*******************************************************************************
+********************************************************************************/
+-->
+  <zorba:iterator name="IsFollowingStructuralInformationIterator">
+
+    <zorba:description author="Federico Cavalieri"></zorba:description>
+
+    <zorba:function>
+      <zorba:signature localname="following-of" prefix="fn-zorba-struct">
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:output>xs:boolean</zorba:output>
+      </zorba:signature>
+    </zorba:function>
+
+  </zorba:iterator>
+
+  <!--
+/*******************************************************************************
+********************************************************************************/
+-->
+  <zorba:iterator name="IsDescendantStructuralInformationIterator">
+
+    <zorba:description author="Federico Cavalieri"></zorba:description>
+
+    <zorba:function>
+      <zorba:signature localname="descendant-of" prefix="fn-zorba-struct">
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:output>xs:boolean</zorba:output>
+      </zorba:signature>
+    </zorba:function>
+
+  </zorba:iterator>
+
+  <!--
+/*******************************************************************************
+********************************************************************************/
+-->
+  <zorba:iterator name="IsPrecedingSiblingStructuralInformationIterator">
+
+    <zorba:description author="Federico Cavalieri"></zorba:description>
+
+    <zorba:function>
+      <zorba:signature localname="preceding-sibling-of" prefix="fn-zorba-struct">
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:output>xs:boolean</zorba:output>
+      </zorba:signature>
+    </zorba:function>
+
+  </zorba:iterator>
+
+  <!--
+/*******************************************************************************
+********************************************************************************/
+-->
+  <zorba:iterator name="IsPrecedingStructuralInformationIterator">
+
+    <zorba:description author="Federico Cavalieri"></zorba:description>
+
+    <zorba:function>
+      <zorba:signature localname="preceding-of" prefix="fn-zorba-struct">
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:output>xs:boolean</zorba:output>
+      </zorba:signature>
+    </zorba:function>
+
+  </zorba:iterator>
+
+  <!--
+/*******************************************************************************
+********************************************************************************/
+-->
+  <zorba:iterator name="IsChildStructuralInformationIterator">
+
+    <zorba:description author="Federico Cavalieri"></zorba:description>
+
+    <zorba:function>
+      <zorba:signature localname="child-of" prefix="fn-zorba-struct">
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:output>xs:boolean</zorba:output>
+      </zorba:signature>
+    </zorba:function>
+
+  </zorba:iterator>
+
+  <!--
+/*******************************************************************************
+********************************************************************************/
+-->
+  <zorba:iterator name="IsAttributeOfStructuralInformationIterator">
+
+    <zorba:description author="Federico Cavalieri"></zorba:description>
+
+    <zorba:function>
+      <zorba:signature localname="attribute-of" prefix="fn-zorba-struct">
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:output>xs:boolean</zorba:output>
+      </zorba:signature>
+    </zorba:function>
+
+  </zorba:iterator>
+
+
+  <!--
+/*******************************************************************************
+********************************************************************************/
+-->
+  <zorba:iterator name="IsParentStructuralInformationIterator">
+
+    <zorba:description author="Federico Cavalieri"></zorba:description>
+
+    <zorba:function>
+      <zorba:signature localname="parent-of" prefix="fn-zorba-struct">
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:output>xs:boolean</zorba:output>
+      </zorba:signature>
+    </zorba:function>
+
+  </zorba:iterator>
+
+  <!--
+/*******************************************************************************
+********************************************************************************/
+-->
+  <zorba:iterator name="IsPrecedingInDocumentOrderStructuralInformationIterator">
+
+    <zorba:description author="Federico Cavalieri"></zorba:description>
+
+    <zorba:function>
+      <zorba:signature localname="preceding-in-document-order-of" prefix="fn-zorba-struct">
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:output>xs:boolean</zorba:output>
+      </zorba:signature>
+    </zorba:function>
+
+  </zorba:iterator>
+
+  <!--
+/*******************************************************************************
+********************************************************************************/
+-->
+  <zorba:iterator name="IsFollowingInDocumentOrderStructuralInformationIterator">
+
+    <zorba:description author="Federico Cavalieri"></zorba:description>
+
+    <zorba:function>
+      <zorba:signature localname="following-in-document-order-of" prefix="fn-zorba-struct">
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:output>xs:boolean</zorba:output>
+      </zorba:signature>
+    </zorba:function>
+
+  </zorba:iterator>
+
+  <!--
+/*******************************************************************************
+********************************************************************************/
+-->
+  <zorba:iterator name="LevelStructuralInformationIterator">
+
+    <zorba:description author="Federico Cavalieri"></zorba:description>
+
+    <zorba:function>
+      <zorba:signature localname="level" prefix="fn-zorba-struct">
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:output>xs:integer</zorba:output>
+      </zorba:signature>
+    </zorba:function>
+
+  </zorba:iterator>
+
+  <!--
+/*******************************************************************************
+********************************************************************************/
+-->
+  <zorba:iterator name="IsAttributeStructuralInformationIterator">
+
+    <zorba:description author="Federico Cavalieri"></zorba:description>
+
+    <zorba:function>
+      <zorba:signature localname="is-attribute" prefix="fn-zorba-struct">
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:output>xs:boolean</zorba:output>
+      </zorba:signature>
+    </zorba:function>
+
+  </zorba:iterator>
+
+  <!--
+/*******************************************************************************
+********************************************************************************/
+-->
+  <zorba:iterator name="IsCommentStructuralInformationIterator">
+
+    <zorba:description author="Federico Cavalieri"></zorba:description>
+
+    <zorba:function>
+      <zorba:signature localname="is-comment" prefix="fn-zorba-struct">
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:output>xs:boolean</zorba:output>
+      </zorba:signature>
+    </zorba:function>
+
+  </zorba:iterator>
+  
+    <!--
+/*******************************************************************************
+********************************************************************************/
+-->
+  <zorba:iterator name="IsDocumentStructuralInformationIterator">
+
+    <zorba:description author="Federico Cavalieri"></zorba:description>
+
+    <zorba:function>
+      <zorba:signature localname="is-document" prefix="fn-zorba-struct">
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:output>xs:boolean</zorba:output>
+      </zorba:signature>
+    </zorba:function>
+
+  </zorba:iterator>
+  
+    <!--
+/*******************************************************************************
+********************************************************************************/
+-->
+  <zorba:iterator name="IsElementStructuralInformationIterator">
+
+    <zorba:description author="Federico Cavalieri"></zorba:description>
+
+    <zorba:function>
+      <zorba:signature localname="is-element" prefix="fn-zorba-struct">
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:output>xs:boolean</zorba:output>
+      </zorba:signature>
+    </zorba:function>
+
+  </zorba:iterator>
+  
+    <!--
+/*******************************************************************************
+********************************************************************************/
+-->
+  <zorba:iterator name="IsProcessingInstructionStructuralInformationIterator">
+
+    <zorba:description author="Federico Cavalieri"></zorba:description>
+
+    <zorba:function>
+      <zorba:signature localname="is-processing-instruction" prefix="fn-zorba-struct">
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:output>xs:boolean</zorba:output>
+      </zorba:signature>
+    </zorba:function>
+
+  </zorba:iterator>
+  
+    <!--
+/*******************************************************************************
+********************************************************************************/
+-->
+  <zorba:iterator name="IsTextStructuralInformationIterator">
+
+    <zorba:description author="Federico Cavalieri"></zorba:description>
+
+    <zorba:function>
+      <zorba:signature localname="is-text" prefix="fn-zorba-struct">
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:output>xs:boolean</zorba:output>
+      </zorba:signature>
+    </zorba:function>
+
+  </zorba:iterator>
+
+  <!--
+/*******************************************************************************
+********************************************************************************/
+-->
+  <zorba:iterator name="IsSiblingStructuralInformationIterator">
+
+    <zorba:description author="Federico Cavalieri"></zorba:description>
+
+    <zorba:function>
+      <zorba:signature localname="sibling-of" prefix="fn-zorba-struct">
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:output>xs:boolean</zorba:output>
+      </zorba:signature>
+    </zorba:function>
+
+  </zorba:iterator>
+
+  <!--
+/*******************************************************************************
+********************************************************************************/
+-->
+  <zorba:iterator name="InSameTreeStructuralInformationIterator">
+
+    <zorba:description author="Federico Cavalieri"></zorba:description>
+
+    <zorba:function>
+      <zorba:signature localname="in-same-tree-of" prefix="fn-zorba-struct">
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:output>xs:boolean</zorba:output>
+      </zorba:signature>
+    </zorba:function>
+
+  </zorba:iterator>
+  
+  <!--
+/*******************************************************************************
+********************************************************************************/
+-->
+  <zorba:iterator name="InCollectionStructuralInformationIterator">
+
+    <zorba:description author="Federico Cavalieri"></zorba:description>
+
+    <zorba:function>
+      <zorba:signature localname="in-collection" prefix="fn-zorba-struct">
+        <zorba:param>xs:anyURI</zorba:param>        
+        <zorba:output>xs:boolean</zorba:output>
+      </zorba:signature>
+    </zorba:function>
+
+  </zorba:iterator>
+  
+  <!--
+/*******************************************************************************
+********************************************************************************/
+-->
+  <zorba:iterator name="InSameCollectionStructuralInformationIterator">
+
+    <zorba:description author="Federico Cavalieri"></zorba:description>
+
+    <zorba:function>
+      <zorba:signature localname="in-same-collection-of" prefix="fn-zorba-struct">
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:param>xs:anyURI</zorba:param>
+        <zorba:output>xs:boolean</zorba:output>
+      </zorba:signature>
+    </zorba:function>
+
+  </zorba:iterator>
+  
+</zorba:iterators>

=== modified file 'src/runtime/visitors/pregenerated/planiter_visitor.h'
--- src/runtime/visitors/pregenerated/planiter_visitor.h	2011-08-17 20:22:07 +0000
+++ src/runtime/visitors/pregenerated/planiter_visitor.h	2011-10-06 09:58:24 +0000
@@ -341,6 +341,52 @@
 
     class LeastCommonAncestor;
 
+    class NodeStructuralInformationIterator;
+
+    class IsAncestorStructuralInformationIterator;
+
+    class IsFollowingSiblingStructuralInformationIterator;
+
+    class IsFollowingStructuralInformationIterator;
+
+    class IsDescendantStructuralInformationIterator;
+
+    class IsPrecedingSiblingStructuralInformationIterator;
+
+    class IsPrecedingStructuralInformationIterator;
+
+    class IsChildStructuralInformationIterator;
+
+    class IsAttributeOfStructuralInformationIterator;
+
+    class IsParentStructuralInformationIterator;
+
+    class IsPrecedingInDocumentOrderStructuralInformationIterator;
+
+    class IsFollowingInDocumentOrderStructuralInformationIterator;
+
+    class LevelStructuralInformationIterator;
+
+    class IsAttributeStructuralInformationIterator;
+
+    class IsCommentStructuralInformationIterator;
+
+    class IsDocumentStructuralInformationIterator;
+
+    class IsElementStructuralInformationIterator;
+
+    class IsProcessingInstructionStructuralInformationIterator;
+
+    class IsTextStructuralInformationIterator;
+
+    class IsSiblingStructuralInformationIterator;
+
+    class InSameTreeStructuralInformationIterator;
+
+    class InCollectionStructuralInformationIterator;
+
+    class InSameCollectionStructuralInformationIterator;
+
     class AbsIterator;
 
     class CeilingIterator;
@@ -1012,6 +1058,75 @@
     virtual void beginVisit ( const LeastCommonAncestor& ) = 0;
     virtual void endVisit   ( const LeastCommonAncestor& ) = 0;
 
+    virtual void beginVisit ( const NodeStructuralInformationIterator& ) = 0;
+    virtual void endVisit   ( const NodeStructuralInformationIterator& ) = 0;
+
+    virtual void beginVisit ( const IsAncestorStructuralInformationIterator& ) = 0;
+    virtual void endVisit   ( const IsAncestorStructuralInformationIterator& ) = 0;
+
+    virtual void beginVisit ( const IsFollowingSiblingStructuralInformationIterator& ) = 0;
+    virtual void endVisit   ( const IsFollowingSiblingStructuralInformationIterator& ) = 0;
+
+    virtual void beginVisit ( const IsFollowingStructuralInformationIterator& ) = 0;
+    virtual void endVisit   ( const IsFollowingStructuralInformationIterator& ) = 0;
+
+    virtual void beginVisit ( const IsDescendantStructuralInformationIterator& ) = 0;
+    virtual void endVisit   ( const IsDescendantStructuralInformationIterator& ) = 0;
+
+    virtual void beginVisit ( const IsPrecedingSiblingStructuralInformationIterator& ) = 0;
+    virtual void endVisit   ( const IsPrecedingSiblingStructuralInformationIterator& ) = 0;
+
+    virtual void beginVisit ( const IsPrecedingStructuralInformationIterator& ) = 0;
+    virtual void endVisit   ( const IsPrecedingStructuralInformationIterator& ) = 0;
+
+    virtual void beginVisit ( const IsChildStructuralInformationIterator& ) = 0;
+    virtual void endVisit   ( const IsChildStructuralInformationIterator& ) = 0;
+
+    virtual void beginVisit ( const IsAttributeOfStructuralInformationIterator& ) = 0;
+    virtual void endVisit   ( const IsAttributeOfStructuralInformationIterator& ) = 0;
+
+    virtual void beginVisit ( const IsParentStructuralInformationIterator& ) = 0;
+    virtual void endVisit   ( const IsParentStructuralInformationIterator& ) = 0;
+
+    virtual void beginVisit ( const IsPrecedingInDocumentOrderStructuralInformationIterator& ) = 0;
+    virtual void endVisit   ( const IsPrecedingInDocumentOrderStructuralInformationIterator& ) = 0;
+
+    virtual void beginVisit ( const IsFollowingInDocumentOrderStructuralInformationIterator& ) = 0;
+    virtual void endVisit   ( const IsFollowingInDocumentOrderStructuralInformationIterator& ) = 0;
+
+    virtual void beginVisit ( const LevelStructuralInformationIterator& ) = 0;
+    virtual void endVisit   ( const LevelStructuralInformationIterator& ) = 0;
+
+    virtual void beginVisit ( const IsAttributeStructuralInformationIterator& ) = 0;
+    virtual void endVisit   ( const IsAttributeStructuralInformationIterator& ) = 0;
+
+    virtual void beginVisit ( const IsCommentStructuralInformationIterator& ) = 0;
+    virtual void endVisit   ( const IsCommentStructuralInformationIterator& ) = 0;
+
+    virtual void beginVisit ( const IsDocumentStructuralInformationIterator& ) = 0;
+    virtual void endVisit   ( const IsDocumentStructuralInformationIterator& ) = 0;
+
+    virtual void beginVisit ( const IsElementStructuralInformationIterator& ) = 0;
+    virtual void endVisit   ( const IsElementStructuralInformationIterator& ) = 0;
+
+    virtual void beginVisit ( const IsProcessingInstructionStructuralInformationIterator& ) = 0;
+    virtual void endVisit   ( const IsProcessingInstructionStructuralInformationIterator& ) = 0;
+
+    virtual void beginVisit ( const IsTextStructuralInformationIterator& ) = 0;
+    virtual void endVisit   ( const IsTextStructuralInformationIterator& ) = 0;
+
+    virtual void beginVisit ( const IsSiblingStructuralInformationIterator& ) = 0;
+    virtual void endVisit   ( const IsSiblingStructuralInformationIterator& ) = 0;
+
+    virtual void beginVisit ( const InSameTreeStructuralInformationIterator& ) = 0;
+    virtual void endVisit   ( const InSameTreeStructuralInformationIterator& ) = 0;
+
+    virtual void beginVisit ( const InCollectionStructuralInformationIterator& ) = 0;
+    virtual void endVisit   ( const InCollectionStructuralInformationIterator& ) = 0;
+
+    virtual void beginVisit ( const InSameCollectionStructuralInformationIterator& ) = 0;
+    virtual void endVisit   ( const InSameCollectionStructuralInformationIterator& ) = 0;
+
     virtual void beginVisit ( const AbsIterator& ) = 0;
     virtual void endVisit   ( const AbsIterator& ) = 0;
 

=== modified file 'src/runtime/visitors/pregenerated/printer_visitor.cpp'
--- src/runtime/visitors/pregenerated/printer_visitor.cpp	2011-08-17 20:22:07 +0000
+++ src/runtime/visitors/pregenerated/printer_visitor.cpp	2011-10-06 09:58:24 +0000
@@ -52,6 +52,7 @@
 #include "runtime/introspection/sctx.h"
 #include "runtime/maths/maths.h"
 #include "runtime/nodes/nodes.h"
+#include "runtime/nodes/structural.h"
 #include "runtime/numerics/numerics.h"
 #include "runtime/parsing_and_serializing/parse_fragment.h"
 #include "runtime/parsing_and_serializing/parsing_and_serializing.h"
@@ -2279,6 +2280,328 @@
 // </LeastCommonAncestor>
 
 
+// <NodeStructuralInformationIterator>
+void PrinterVisitor::beginVisit ( const NodeStructuralInformationIterator& a) {
+  thePrinter.startBeginVisit("NodeStructuralInformationIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const NodeStructuralInformationIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </NodeStructuralInformationIterator>
+
+
+// <IsAncestorStructuralInformationIterator>
+void PrinterVisitor::beginVisit ( const IsAncestorStructuralInformationIterator& a) {
+  thePrinter.startBeginVisit("IsAncestorStructuralInformationIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const IsAncestorStructuralInformationIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </IsAncestorStructuralInformationIterator>
+
+
+// <IsFollowingSiblingStructuralInformationIterator>
+void PrinterVisitor::beginVisit ( const IsFollowingSiblingStructuralInformationIterator& a) {
+  thePrinter.startBeginVisit("IsFollowingSiblingStructuralInformationIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const IsFollowingSiblingStructuralInformationIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </IsFollowingSiblingStructuralInformationIterator>
+
+
+// <IsFollowingStructuralInformationIterator>
+void PrinterVisitor::beginVisit ( const IsFollowingStructuralInformationIterator& a) {
+  thePrinter.startBeginVisit("IsFollowingStructuralInformationIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const IsFollowingStructuralInformationIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </IsFollowingStructuralInformationIterator>
+
+
+// <IsDescendantStructuralInformationIterator>
+void PrinterVisitor::beginVisit ( const IsDescendantStructuralInformationIterator& a) {
+  thePrinter.startBeginVisit("IsDescendantStructuralInformationIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const IsDescendantStructuralInformationIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </IsDescendantStructuralInformationIterator>
+
+
+// <IsPrecedingSiblingStructuralInformationIterator>
+void PrinterVisitor::beginVisit ( const IsPrecedingSiblingStructuralInformationIterator& a) {
+  thePrinter.startBeginVisit("IsPrecedingSiblingStructuralInformationIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const IsPrecedingSiblingStructuralInformationIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </IsPrecedingSiblingStructuralInformationIterator>
+
+
+// <IsPrecedingStructuralInformationIterator>
+void PrinterVisitor::beginVisit ( const IsPrecedingStructuralInformationIterator& a) {
+  thePrinter.startBeginVisit("IsPrecedingStructuralInformationIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const IsPrecedingStructuralInformationIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </IsPrecedingStructuralInformationIterator>
+
+
+// <IsChildStructuralInformationIterator>
+void PrinterVisitor::beginVisit ( const IsChildStructuralInformationIterator& a) {
+  thePrinter.startBeginVisit("IsChildStructuralInformationIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const IsChildStructuralInformationIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </IsChildStructuralInformationIterator>
+
+
+// <IsAttributeOfStructuralInformationIterator>
+void PrinterVisitor::beginVisit ( const IsAttributeOfStructuralInformationIterator& a) {
+  thePrinter.startBeginVisit("IsAttributeOfStructuralInformationIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const IsAttributeOfStructuralInformationIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </IsAttributeOfStructuralInformationIterator>
+
+
+// <IsParentStructuralInformationIterator>
+void PrinterVisitor::beginVisit ( const IsParentStructuralInformationIterator& a) {
+  thePrinter.startBeginVisit("IsParentStructuralInformationIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const IsParentStructuralInformationIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </IsParentStructuralInformationIterator>
+
+
+// <IsPrecedingInDocumentOrderStructuralInformationIterator>
+void PrinterVisitor::beginVisit ( const IsPrecedingInDocumentOrderStructuralInformationIterator& a) {
+  thePrinter.startBeginVisit("IsPrecedingInDocumentOrderStructuralInformationIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const IsPrecedingInDocumentOrderStructuralInformationIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </IsPrecedingInDocumentOrderStructuralInformationIterator>
+
+
+// <IsFollowingInDocumentOrderStructuralInformationIterator>
+void PrinterVisitor::beginVisit ( const IsFollowingInDocumentOrderStructuralInformationIterator& a) {
+  thePrinter.startBeginVisit("IsFollowingInDocumentOrderStructuralInformationIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const IsFollowingInDocumentOrderStructuralInformationIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </IsFollowingInDocumentOrderStructuralInformationIterator>
+
+
+// <LevelStructuralInformationIterator>
+void PrinterVisitor::beginVisit ( const LevelStructuralInformationIterator& a) {
+  thePrinter.startBeginVisit("LevelStructuralInformationIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const LevelStructuralInformationIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </LevelStructuralInformationIterator>
+
+
+// <IsAttributeStructuralInformationIterator>
+void PrinterVisitor::beginVisit ( const IsAttributeStructuralInformationIterator& a) {
+  thePrinter.startBeginVisit("IsAttributeStructuralInformationIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const IsAttributeStructuralInformationIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </IsAttributeStructuralInformationIterator>
+
+
+// <IsCommentStructuralInformationIterator>
+void PrinterVisitor::beginVisit ( const IsCommentStructuralInformationIterator& a) {
+  thePrinter.startBeginVisit("IsCommentStructuralInformationIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const IsCommentStructuralInformationIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </IsCommentStructuralInformationIterator>
+
+
+// <IsDocumentStructuralInformationIterator>
+void PrinterVisitor::beginVisit ( const IsDocumentStructuralInformationIterator& a) {
+  thePrinter.startBeginVisit("IsDocumentStructuralInformationIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const IsDocumentStructuralInformationIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </IsDocumentStructuralInformationIterator>
+
+
+// <IsElementStructuralInformationIterator>
+void PrinterVisitor::beginVisit ( const IsElementStructuralInformationIterator& a) {
+  thePrinter.startBeginVisit("IsElementStructuralInformationIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const IsElementStructuralInformationIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </IsElementStructuralInformationIterator>
+
+
+// <IsProcessingInstructionStructuralInformationIterator>
+void PrinterVisitor::beginVisit ( const IsProcessingInstructionStructuralInformationIterator& a) {
+  thePrinter.startBeginVisit("IsProcessingInstructionStructuralInformationIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const IsProcessingInstructionStructuralInformationIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </IsProcessingInstructionStructuralInformationIterator>
+
+
+// <IsTextStructuralInformationIterator>
+void PrinterVisitor::beginVisit ( const IsTextStructuralInformationIterator& a) {
+  thePrinter.startBeginVisit("IsTextStructuralInformationIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const IsTextStructuralInformationIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </IsTextStructuralInformationIterator>
+
+
+// <IsSiblingStructuralInformationIterator>
+void PrinterVisitor::beginVisit ( const IsSiblingStructuralInformationIterator& a) {
+  thePrinter.startBeginVisit("IsSiblingStructuralInformationIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const IsSiblingStructuralInformationIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </IsSiblingStructuralInformationIterator>
+
+
+// <InSameTreeStructuralInformationIterator>
+void PrinterVisitor::beginVisit ( const InSameTreeStructuralInformationIterator& a) {
+  thePrinter.startBeginVisit("InSameTreeStructuralInformationIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const InSameTreeStructuralInformationIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </InSameTreeStructuralInformationIterator>
+
+
+// <InCollectionStructuralInformationIterator>
+void PrinterVisitor::beginVisit ( const InCollectionStructuralInformationIterator& a) {
+  thePrinter.startBeginVisit("InCollectionStructuralInformationIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const InCollectionStructuralInformationIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </InCollectionStructuralInformationIterator>
+
+
+// <InSameCollectionStructuralInformationIterator>
+void PrinterVisitor::beginVisit ( const InSameCollectionStructuralInformationIterator& a) {
+  thePrinter.startBeginVisit("InSameCollectionStructuralInformationIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const InSameCollectionStructuralInformationIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </InSameCollectionStructuralInformationIterator>
+
+
 // <AbsIterator>
 void PrinterVisitor::beginVisit ( const AbsIterator& a) {
   thePrinter.startBeginVisit("AbsIterator", ++theId);

=== modified file 'src/runtime/visitors/pregenerated/printer_visitor.h'
--- src/runtime/visitors/pregenerated/printer_visitor.h	2011-08-17 20:22:07 +0000
+++ src/runtime/visitors/pregenerated/printer_visitor.h	2011-10-06 09:58:24 +0000
@@ -514,6 +514,75 @@
     void beginVisit( const LeastCommonAncestor& );
     void endVisit  ( const LeastCommonAncestor& );
 
+    void beginVisit( const NodeStructuralInformationIterator& );
+    void endVisit  ( const NodeStructuralInformationIterator& );
+
+    void beginVisit( const IsAncestorStructuralInformationIterator& );
+    void endVisit  ( const IsAncestorStructuralInformationIterator& );
+
+    void beginVisit( const IsFollowingSiblingStructuralInformationIterator& );
+    void endVisit  ( const IsFollowingSiblingStructuralInformationIterator& );
+
+    void beginVisit( const IsFollowingStructuralInformationIterator& );
+    void endVisit  ( const IsFollowingStructuralInformationIterator& );
+
+    void beginVisit( const IsDescendantStructuralInformationIterator& );
+    void endVisit  ( const IsDescendantStructuralInformationIterator& );
+
+    void beginVisit( const IsPrecedingSiblingStructuralInformationIterator& );
+    void endVisit  ( const IsPrecedingSiblingStructuralInformationIterator& );
+
+    void beginVisit( const IsPrecedingStructuralInformationIterator& );
+    void endVisit  ( const IsPrecedingStructuralInformationIterator& );
+
+    void beginVisit( const IsChildStructuralInformationIterator& );
+    void endVisit  ( const IsChildStructuralInformationIterator& );
+
+    void beginVisit( const IsAttributeOfStructuralInformationIterator& );
+    void endVisit  ( const IsAttributeOfStructuralInformationIterator& );
+
+    void beginVisit( const IsParentStructuralInformationIterator& );
+    void endVisit  ( const IsParentStructuralInformationIterator& );
+
+    void beginVisit( const IsPrecedingInDocumentOrderStructuralInformationIterator& );
+    void endVisit  ( const IsPrecedingInDocumentOrderStructuralInformationIterator& );
+
+    void beginVisit( const IsFollowingInDocumentOrderStructuralInformationIterator& );
+    void endVisit  ( const IsFollowingInDocumentOrderStructuralInformationIterator& );
+
+    void beginVisit( const LevelStructuralInformationIterator& );
+    void endVisit  ( const LevelStructuralInformationIterator& );
+
+    void beginVisit( const IsAttributeStructuralInformationIterator& );
+    void endVisit  ( const IsAttributeStructuralInformationIterator& );
+
+    void beginVisit( const IsCommentStructuralInformationIterator& );
+    void endVisit  ( const IsCommentStructuralInformationIterator& );
+
+    void beginVisit( const IsDocumentStructuralInformationIterator& );
+    void endVisit  ( const IsDocumentStructuralInformationIterator& );
+
+    void beginVisit( const IsElementStructuralInformationIterator& );
+    void endVisit  ( const IsElementStructuralInformationIterator& );
+
+    void beginVisit( const IsProcessingInstructionStructuralInformationIterator& );
+    void endVisit  ( const IsProcessingInstructionStructuralInformationIterator& );
+
+    void beginVisit( const IsTextStructuralInformationIterator& );
+    void endVisit  ( const IsTextStructuralInformationIterator& );
+
+    void beginVisit( const IsSiblingStructuralInformationIterator& );
+    void endVisit  ( const IsSiblingStructuralInformationIterator& );
+
+    void beginVisit( const InSameTreeStructuralInformationIterator& );
+    void endVisit  ( const InSameTreeStructuralInformationIterator& );
+
+    void beginVisit( const InCollectionStructuralInformationIterator& );
+    void endVisit  ( const InCollectionStructuralInformationIterator& );
+
+    void beginVisit( const InSameCollectionStructuralInformationIterator& );
+    void endVisit  ( const InSameCollectionStructuralInformationIterator& );
+
     void beginVisit( const AbsIterator& );
     void endVisit  ( const AbsIterator& );
 

=== modified file 'src/store/api/item.h'
--- src/store/api/item.h	2011-09-30 14:06:33 +0000
+++ src/store/api/item.h	2011-10-06 09:58:24 +0000
@@ -686,17 +686,95 @@
    *
    */
   virtual bool
+  isAttribute(const store::Item_t&) const;
+
+  /**
+   *
+   */
+  virtual bool
   isParent(const store::Item_t&) const;
 
   /**
    *
    */
+  virtual bool
+  isPrecedingInDocumentOrder(const store::Item_t&) const;
+
+  /**
+   *
+   */
+  virtual bool
+  isFollowingInDocumentOrder(const store::Item_t&) const;
+
+  /**
+   *
+   */
   virtual store::Item_t
   getLevel() const;
 
   /**
    *
    */
+  virtual bool
+  isSibling(const store::Item_t&) const;
+
+  /**
+   *
+   */
+  virtual bool
+  isAttribute() const;
+
+  /**
+   *
+   */
+  virtual bool
+  isComment() const;
+
+  /**
+   *
+   */
+  virtual bool
+  isDocument() const;
+
+  /**
+   *
+   */
+  virtual bool
+  isElement() const;
+
+  /**
+   *
+   */
+  virtual bool
+  isProcessingInstruction() const;
+
+  /**
+   *
+   */
+  virtual bool
+  isText() const;
+
+  /**
+   *
+   */
+  virtual bool
+  inSameTree(const store::Item_t&) const;
+
+  /**
+   *
+   */
+  virtual bool
+  inCollection() const;
+
+  /**
+   *
+   */
+  virtual bool
+  inSameCollection(const store::Item_t&) const;
+
+  /**
+   *
+   */
   virtual store::Item_t
   leastCommonAncestor(const store::Item_t&) const;
 

=== modified file 'src/store/api/store.h'
--- src/store/api/store.h	2011-09-27 10:43:46 +0000
+++ src/store/api/store.h	2011-10-06 09:58:24 +0000
@@ -105,7 +105,17 @@
    * @returns referenced item if it exists, otherwise NULL
    */
   virtual bool getNodeByReference(Item_t& result, const Item* uri) = 0;
+
+  /* ------------------ Structural Information Management ----------------------*/
 		
+  /** 
+   * Computes the structural information of the passed item.
+   *
+   * @param item XDM item
+   * @return Returns an item of type xs:uri 
+   */
+  virtual bool getStructuralInformation(Item_t& result, const Item* node) = 0;
+
 		
   /* --------------------------- Node Id Management ---------------------------*/
 

=== modified file 'src/store/naive/atomic_items.cpp'
--- src/store/naive/atomic_items.cpp	2011-09-30 14:06:33 +0000
+++ src/store/naive/atomic_items.cpp	2011-10-06 09:58:24 +0000
@@ -14,6 +14,7 @@
  * limitations under the License.
  */
 #include "stdafx.h"
+#include <limits.h>
 
 #include <zorba/internal/unique_ptr.h>
 
@@ -38,6 +39,7 @@
 #include "store/naive/item_iterator.h"
 #include "store/naive/node_items.h"
 #include "store/naive/atomic_items.h"
+#include "store/naive/ordpath.h"
 
 #include "util/ascii_util.h"
 #include "util/string_util.h"
@@ -816,6 +818,572 @@
   return res;
 }
 
+bool AnyUriItem::isAncestor(const store::Item_t& aOther) const
+{
+  store::Item_t lThisUri;
+  GET_FACTORY().createStructuralAnyURI(lThisUri,theValue.c_str());
+  return lThisUri->isAncestor(aOther);
+}
+
+bool AnyUriItem::isFollowingSibling(const store::Item_t& aOther) const
+{
+  store::Item_t lThisUri;
+  GET_FACTORY().createStructuralAnyURI(lThisUri,theValue.c_str());
+  return lThisUri->isFollowingSibling(aOther);
+}
+
+bool AnyUriItem::isFollowing(const store::Item_t& aOther) const
+{
+  store::Item_t lThisUri;
+  GET_FACTORY().createStructuralAnyURI(lThisUri,theValue.c_str());
+  return lThisUri->isFollowing(aOther);
+}
+
+bool AnyUriItem::isDescendant(const store::Item_t& aOther) const
+{
+  store::Item_t lThisUri;
+  GET_FACTORY().createStructuralAnyURI(lThisUri,theValue.c_str());
+  return lThisUri->isDescendant(aOther);
+}
+
+bool AnyUriItem::isPrecedingSibling(const store::Item_t& aOther) const
+{
+  store::Item_t lThisUri;
+  GET_FACTORY().createStructuralAnyURI(lThisUri,theValue.c_str());
+  return lThisUri->isPrecedingSibling(aOther);
+}
+
+bool AnyUriItem::isPreceding(const store::Item_t& aOther) const
+{
+  store::Item_t lThisUri;
+  GET_FACTORY().createStructuralAnyURI(lThisUri,theValue.c_str());
+  return lThisUri->isPreceding(aOther);
+}
+
+bool AnyUriItem::isChild(const store::Item_t& aOther) const
+{
+  store::Item_t lThisUri;
+  GET_FACTORY().createStructuralAnyURI(lThisUri,theValue.c_str());
+  return lThisUri->isChild(aOther);
+}
+
+bool AnyUriItem::isAttribute(const store::Item_t& aOther) const
+{
+  store::Item_t lThisUri;
+  GET_FACTORY().createStructuralAnyURI(lThisUri,theValue.c_str());
+  return lThisUri->isAttribute(aOther);
+}
+
+bool AnyUriItem::isParent(const store::Item_t& aOther) const
+{
+  store::Item_t lThisUri;
+  GET_FACTORY().createStructuralAnyURI(lThisUri,theValue.c_str());
+  return lThisUri->isParent(aOther);
+}
+
+bool AnyUriItem::isPrecedingInDocumentOrder(const store::Item_t& aOther) const
+{
+  store::Item_t lThisUri;
+  GET_FACTORY().createStructuralAnyURI(lThisUri,theValue.c_str());
+  return lThisUri->isPrecedingInDocumentOrder(aOther);
+}
+
+bool AnyUriItem::isFollowingInDocumentOrder(const store::Item_t& aOther) const
+{
+  store::Item_t lThisUri;
+  GET_FACTORY().createStructuralAnyURI(lThisUri,theValue.c_str());
+  return lThisUri->isFollowingInDocumentOrder(aOther);
+}
+
+store::Item_t AnyUriItem::getLevel() const
+{
+  store::Item_t lThisUri;
+  GET_FACTORY().createStructuralAnyURI(lThisUri,theValue.c_str());
+  return lThisUri->getLevel();
+}
+
+bool AnyUriItem::isAttribute() const
+{
+  store::Item_t lThisUri;
+  GET_FACTORY().createStructuralAnyURI(lThisUri,theValue.c_str());
+  return lThisUri->isAttribute();
+}
+
+bool AnyUriItem::isComment() const
+{
+  store::Item_t lThisUri;
+  GET_FACTORY().createStructuralAnyURI(lThisUri,theValue.c_str());
+  return lThisUri->isComment();
+}
+
+bool AnyUriItem::isDocument() const
+{
+  store::Item_t lThisUri;
+  GET_FACTORY().createStructuralAnyURI(lThisUri,theValue.c_str());
+  return lThisUri->isDocument();
+}
+
+bool AnyUriItem::isElement() const
+{
+  store::Item_t lThisUri;
+  GET_FACTORY().createStructuralAnyURI(lThisUri,theValue.c_str());
+  return lThisUri->isElement();
+}
+
+bool AnyUriItem::isProcessingInstruction() const
+{
+  store::Item_t lThisUri;
+  GET_FACTORY().createStructuralAnyURI(lThisUri,theValue.c_str());
+  return lThisUri->isProcessingInstruction();
+}
+
+bool AnyUriItem::isText() const
+{
+  store::Item_t lThisUri;
+  GET_FACTORY().createStructuralAnyURI(lThisUri,theValue.c_str());
+  return lThisUri->isText();
+}
+
+bool AnyUriItem::isSibling(const store::Item_t& aOther) const
+{
+  store::Item_t lThisUri;
+  GET_FACTORY().createStructuralAnyURI(lThisUri,theValue.c_str());
+  return lThisUri->isSibling(aOther);
+}
+
+bool AnyUriItem::inSameTree(const store::Item_t& aOther) const
+{
+  store::Item_t lThisUri;
+  GET_FACTORY().createStructuralAnyURI(lThisUri,theValue.c_str());
+  return lThisUri->inSameTree(aOther);
+}
+
+bool AnyUriItem::inCollection() const
+{
+  store::Item_t lThisUri;
+  GET_FACTORY().createStructuralAnyURI(lThisUri,theValue.c_str());
+  return static_cast<StructuralAnyUriItem *>(lThisUri.getp())->inCollection();
+}
+
+bool AnyUriItem::inSameCollection(const store::Item_t& aOther) const
+{
+  store::Item_t lThisUri;
+  GET_FACTORY().createStructuralAnyURI(lThisUri,theValue.c_str());
+  return lThisUri->inSameCollection(aOther);
+}
+
+/*******************************************************************************
+  class StructuralAnyUriItem
+********************************************************************************/
+
+StructuralAnyUriItem::StructuralAnyUriItem(zstring& encoded, ulong collectionId,
+                                           ulong treeId, store::StoreConsts::NodeKind nodeKind,
+                                           const OrdPath& ordPath):
+                                              theCollectionId(collectionId),
+                                              theTreeId(treeId),
+                                              theNodeKind(nodeKind),
+                                              theOrdPath(ordPath)
+{
+  theValue.take(encoded);
+}
+
+StructuralAnyUriItem::StructuralAnyUriItem(zstring& value)
+{
+  theValue.take(value);
+
+  ulong prefixlen = (ulong)strlen("zorba:");
+  if (strncmp(theValue.c_str(), "zorba:", prefixlen))
+    throw ZORBA_EXCEPTION(
+        zerr::ZAPI0028_INVALID_NODE_URI, ERROR_PARAMS( theValue )
+    );
+
+  const char* start;
+  long tmp = 0;
+
+  //
+  // Decode collection id6
+  //
+  start = theValue.c_str() + prefixlen;
+
+  char* next = const_cast<char*>(start);
+
+  tmp = strtol(start, &next, 10);
+
+  if (tmp < 0 || tmp == LONG_MAX)
+    throw ZORBA_EXCEPTION(
+        zerr::ZAPI0028_INVALID_NODE_URI, ERROR_PARAMS( theValue )
+    );
+
+  start = next;
+
+  if (*start != '.')
+    throw ZORBA_EXCEPTION(
+        zerr::ZAPI0028_INVALID_NODE_URI, ERROR_PARAMS( theValue )
+    );
+
+  ++start;
+
+  theCollectionId = (ulong)tmp;
+
+  //
+  // Decode tree id
+  //
+  tmp = strtol(start, &next, 10);
+
+  if (tmp <= 0 || tmp == LONG_MAX)
+    throw ZORBA_EXCEPTION(
+        zerr::ZAPI0028_INVALID_NODE_URI, ERROR_PARAMS( theValue )
+    );
+
+  start = next;
+
+  if (*start != '.')
+    throw ZORBA_EXCEPTION(
+        zerr::ZAPI0028_INVALID_NODE_URI, ERROR_PARAMS( theValue )
+    );
+
+  ++start;
+
+  theTreeId = (ulong)tmp;
+
+  //
+  // Parse the node kind
+  //
+  if (*start > '0' && *start <='6')
+    theNodeKind=static_cast<store::StoreConsts::NodeKind>(*start-'0');
+  else
+    throw ZORBA_EXCEPTION(
+        zerr::ZAPI0028_INVALID_NODE_URI, ERROR_PARAMS( theValue )
+    );
+
+  ++start;
+  if (*start != '.')
+    throw ZORBA_EXCEPTION(
+        zerr::ZAPI0028_INVALID_NODE_URI, ERROR_PARAMS( theValue )
+    );
+
+  ++start;
+
+
+  //
+  // Decode OrdPath
+  //
+  theOrdPath = OrdPath((unsigned char*)start, (ulong)strlen(start));
+}
+
+bool StructuralAnyUriItem::isAncestor(const store::Item_t& aOther) const
+{
+  AnyUriItem * lOtherUriP=static_cast<AnyUriItem *>(aOther.getp());
+  if (lOtherUriP->getAnyUriTypeCode() != STRUCTURAL_INFORMATION_ANY_URI)
+  {
+    store::Item_t lOtherUri;
+    GET_FACTORY().createStructuralAnyURI(lOtherUri,lOtherUriP->theValue.c_str());
+    return isAncestor(lOtherUri);
+  }
+  else
+  {
+    StructuralAnyUriItem * lOtherStr=static_cast<StructuralAnyUriItem *>(aOther.getp());
+    return (
+            lOtherStr->theTreeId == theTreeId &&
+            theOrdPath.getRelativePosition(lOtherStr->theOrdPath)==OrdPath::ANCESTOR);
+  }
+}
+
+bool StructuralAnyUriItem::isFollowingSibling(const store::Item_t& aOther) const
+{
+  AnyUriItem * lOtherUriP=static_cast<AnyUriItem *>(aOther.getp());
+  if (lOtherUriP->getAnyUriTypeCode() != STRUCTURAL_INFORMATION_ANY_URI)
+  {
+    store::Item_t lOtherUri;
+    GET_FACTORY().createStructuralAnyURI(lOtherUri,lOtherUriP->theValue.c_str());
+    return isFollowingSibling(lOtherUri);
+  }
+  else
+  {
+    StructuralAnyUriItem * lOtherStr=static_cast<StructuralAnyUriItem *>(aOther.getp());
+    return (
+            lOtherStr->theTreeId == theTreeId &&
+            lOtherStr->theNodeKind!=store::StoreConsts::attributeNode &&
+            theNodeKind!=store::StoreConsts::attributeNode &&
+            theOrdPath.getRelativePosition2(lOtherStr->theOrdPath)==OrdPath::FOLLOWING_SIBLING);
+  }
+}
+
+bool StructuralAnyUriItem::isFollowing(const store::Item_t& aOther) const
+{
+  AnyUriItem * lOtherUriP=static_cast<AnyUriItem *>(aOther.getp());
+  if (lOtherUriP->getAnyUriTypeCode() != STRUCTURAL_INFORMATION_ANY_URI)
+  {
+    store::Item_t lOtherUri;
+    GET_FACTORY().createStructuralAnyURI(lOtherUri,lOtherUriP->theValue.c_str());
+    return isFollowing(lOtherUri);
+  }
+  else
+  {
+    StructuralAnyUriItem * lOtherStr=static_cast<StructuralAnyUriItem *>(aOther.getp());
+    return (
+            lOtherStr->theTreeId == theTreeId &&
+            theOrdPath.getRelativePosition(lOtherStr->theOrdPath)==OrdPath::FOLLOWING);
+  }
+}
+
+bool StructuralAnyUriItem::isDescendant(const store::Item_t& aOther) const
+{
+  AnyUriItem * lOtherUriP=static_cast<AnyUriItem *>(aOther.getp());
+  if (lOtherUriP->getAnyUriTypeCode() != STRUCTURAL_INFORMATION_ANY_URI)
+  {
+    store::Item_t lOtherUri;
+    GET_FACTORY().createStructuralAnyURI(lOtherUri,lOtherUriP->theValue.c_str());
+    return isDescendant(lOtherUri);
+  }
+  else
+  {
+    StructuralAnyUriItem * lOtherStr=static_cast<StructuralAnyUriItem *>(aOther.getp());
+    return (
+            lOtherStr->theTreeId == theTreeId &&
+            theOrdPath.getRelativePosition(lOtherStr->theOrdPath)==OrdPath::DESCENDANT);
+  }
+}
+
+bool StructuralAnyUriItem::isPrecedingSibling(const store::Item_t& aOther) const
+{
+  AnyUriItem * lOtherUriP=static_cast<AnyUriItem *>(aOther.getp());
+  if (lOtherUriP->getAnyUriTypeCode() != STRUCTURAL_INFORMATION_ANY_URI)
+  {
+    store::Item_t lOtherUri;
+    GET_FACTORY().createStructuralAnyURI(lOtherUri,lOtherUriP->theValue.c_str());
+    return isPrecedingSibling(lOtherUri);
+  }
+  else
+  {
+    StructuralAnyUriItem * lOtherStr=static_cast<StructuralAnyUriItem *>(aOther.getp());
+    return (
+            lOtherStr->theTreeId == theTreeId &&
+            lOtherStr->theNodeKind!=store::StoreConsts::attributeNode &&
+            theNodeKind!=store::StoreConsts::attributeNode &&
+            theOrdPath.getRelativePosition2(lOtherStr->theOrdPath)==OrdPath::PRECEDING_SIBLING);
+  }
+}
+
+bool StructuralAnyUriItem::isPreceding(const store::Item_t& aOther) const
+{
+  AnyUriItem * lOtherUriP=static_cast<AnyUriItem *>(aOther.getp());
+  if (lOtherUriP->getAnyUriTypeCode() != STRUCTURAL_INFORMATION_ANY_URI)
+  {
+    store::Item_t lOtherUri;
+    GET_FACTORY().createStructuralAnyURI(lOtherUri,lOtherUriP->theValue.c_str());
+    return isPreceding(lOtherUri);
+  }
+  else
+  {
+    StructuralAnyUriItem * lOtherStr=static_cast<StructuralAnyUriItem *>(aOther.getp());
+    return (
+        lOtherStr->theTreeId == theTreeId &&
+        theOrdPath.getRelativePosition(lOtherStr->theOrdPath)==OrdPath::PRECEDING);
+  }
+}
+
+bool StructuralAnyUriItem::isChild(const store::Item_t& aOther) const
+{
+  AnyUriItem * lOtherUriP=static_cast<AnyUriItem *>(aOther.getp());
+  if (lOtherUriP->getAnyUriTypeCode() != STRUCTURAL_INFORMATION_ANY_URI)
+  {
+    store::Item_t lOtherUri;
+    GET_FACTORY().createStructuralAnyURI(lOtherUri,lOtherUriP->theValue.c_str());
+    return isChild(lOtherUri);
+  }
+  else
+  {
+    StructuralAnyUriItem * lOtherStr=static_cast<StructuralAnyUriItem *>(aOther.getp());
+    return (
+        lOtherStr->theTreeId == theTreeId &&
+        lOtherStr->theNodeKind!=store::StoreConsts::attributeNode &&
+        theOrdPath.getRelativePosition2(lOtherStr->theOrdPath)==OrdPath::CHILD);
+  }
+}
+
+bool StructuralAnyUriItem::isAttribute(const store::Item_t& aOther) const
+{
+  AnyUriItem * lOtherUriP=static_cast<AnyUriItem *>(aOther.getp());
+  if (lOtherUriP->getAnyUriTypeCode() != STRUCTURAL_INFORMATION_ANY_URI)
+  {
+    store::Item_t lOtherUri;
+    GET_FACTORY().createStructuralAnyURI(lOtherUri,lOtherUriP->theValue.c_str());
+    return isAttribute(lOtherUri);
+  }
+  else
+  {
+    StructuralAnyUriItem * lOtherStr=static_cast<StructuralAnyUriItem *>(aOther.getp());
+    return (
+        lOtherStr->theTreeId == theTreeId &&
+        lOtherStr->theNodeKind==store::StoreConsts::attributeNode &&
+        theOrdPath.getRelativePosition2(lOtherStr->theOrdPath)==OrdPath::CHILD);
+  }
+}
+
+bool StructuralAnyUriItem::isParent(const store::Item_t& aOther) const
+{
+  AnyUriItem * lOtherUriP=static_cast<AnyUriItem *>(aOther.getp());
+  if (lOtherUriP->getAnyUriTypeCode() != STRUCTURAL_INFORMATION_ANY_URI)
+  {
+    store::Item_t lOtherUri;
+    GET_FACTORY().createStructuralAnyURI(lOtherUri,lOtherUriP->theValue.c_str());
+    return isParent(lOtherUri);
+  }
+  else
+  {
+    StructuralAnyUriItem * lOtherStr=static_cast<StructuralAnyUriItem *>(aOther.getp());
+    return (
+        lOtherStr->theTreeId == theTreeId &&
+        theOrdPath.getRelativePosition2(lOtherStr->theOrdPath)==OrdPath::PARENT);
+  }
+}
+
+bool StructuralAnyUriItem::isPrecedingInDocumentOrder(const store::Item_t& aOther) const
+{
+  AnyUriItem * lOtherUriP=static_cast<AnyUriItem *>(aOther.getp());
+  if (lOtherUriP->getAnyUriTypeCode() != STRUCTURAL_INFORMATION_ANY_URI)
+  {
+    store::Item_t lOtherUri;
+    GET_FACTORY().createStructuralAnyURI(lOtherUri,lOtherUriP->theValue.c_str());
+    return isPrecedingInDocumentOrder(lOtherUri);
+  }
+  else
+  {
+    StructuralAnyUriItem * lOtherStr=static_cast<StructuralAnyUriItem *>(aOther.getp());
+    return (
+        theTreeId > lOtherStr->theTreeId
+        ||
+        (
+            lOtherStr->theTreeId == theTreeId &&
+            theOrdPath > lOtherStr->theOrdPath
+        ));
+  }
+}
+
+bool StructuralAnyUriItem::isFollowingInDocumentOrder(const store::Item_t& aOther) const
+{
+  AnyUriItem * lOtherUriP=static_cast<AnyUriItem *>(aOther.getp());
+  if (lOtherUriP->getAnyUriTypeCode() != STRUCTURAL_INFORMATION_ANY_URI)
+  {
+    store::Item_t lOtherUri;
+    GET_FACTORY().createStructuralAnyURI(lOtherUri,lOtherUriP->theValue.c_str());
+    return isFollowingInDocumentOrder(lOtherUri);
+  }
+  else
+  {
+    StructuralAnyUriItem * lOtherStr=static_cast<StructuralAnyUriItem *>(aOther.getp());
+    return (
+        theTreeId < lOtherStr->theTreeId  ||
+        (
+            lOtherStr->theTreeId == theTreeId &&
+            theOrdPath < lOtherStr->theOrdPath
+        ));
+  }
+}
+
+store::Item_t StructuralAnyUriItem::getLevel() const
+{
+  store::Item_t lResult;
+  GET_FACTORY().createInteger(lResult,theOrdPath.getLevel());
+  return lResult;
+}
+
+bool StructuralAnyUriItem::isAttribute() const
+{
+  return theNodeKind==store::StoreConsts::attributeNode;
+}
+
+bool StructuralAnyUriItem::isComment() const
+{
+  return theNodeKind==store::StoreConsts::commentNode;
+}
+
+bool StructuralAnyUriItem::isDocument() const
+{
+  return theNodeKind==store::StoreConsts::documentNode;
+}
+
+bool StructuralAnyUriItem::isElement() const
+{
+  return theNodeKind==store::StoreConsts::elementNode;
+}
+
+bool StructuralAnyUriItem::isProcessingInstruction() const
+{
+  return theNodeKind==store::StoreConsts::piNode;
+}
+
+bool StructuralAnyUriItem::isText() const
+{
+  return theNodeKind==store::StoreConsts::textNode;
+}
+
+bool StructuralAnyUriItem::isSibling(const store::Item_t& aOther) const
+{
+  AnyUriItem * lOtherUriP=static_cast<AnyUriItem *>(aOther.getp());
+  if (lOtherUriP->getAnyUriTypeCode() != STRUCTURAL_INFORMATION_ANY_URI)
+  {
+    store::Item_t lOtherUri;
+    GET_FACTORY().createStructuralAnyURI(lOtherUri,lOtherUriP->theValue.c_str());
+    return isSibling(lOtherUri);
+  }
+  else
+  {
+    StructuralAnyUriItem * lOtherStr=static_cast<StructuralAnyUriItem *>(aOther.getp());
+    OrdPath::RelativePosition2 lPos;
+    return (
+        lOtherStr->theTreeId == theTreeId &&
+        lOtherStr->theNodeKind!=store::StoreConsts::attributeNode &&
+        theNodeKind!=store::StoreConsts::attributeNode &&
+        (
+          (lPos=theOrdPath.getRelativePosition2(lOtherStr->theOrdPath))==OrdPath::FOLLOWING_SIBLING ||
+           lPos==OrdPath::PRECEDING_SIBLING)
+        );
+  }
+}
+
+bool StructuralAnyUriItem::inSameTree(const store::Item_t& aOther) const
+{
+  AnyUriItem * lOtherUriP=static_cast<AnyUriItem *>(aOther.getp());
+  if (lOtherUriP->getAnyUriTypeCode() != STRUCTURAL_INFORMATION_ANY_URI)
+  {
+    store::Item_t lOtherUri;
+    GET_FACTORY().createStructuralAnyURI(lOtherUri,lOtherUriP->theValue.c_str());
+    return inSameTree(lOtherUri);
+  }
+  else
+  {
+    return theTreeId == static_cast<StructuralAnyUriItem *>(aOther.getp())->theTreeId;
+  }
+}
+
+bool StructuralAnyUriItem::inCollection() const
+{
+  return theCollectionId!=0;
+}
+
+bool StructuralAnyUriItem::inSameCollection(const store::Item_t& aOther) const
+{
+  AnyUriItem * lOtherUriP=static_cast<AnyUriItem *>(aOther.getp());
+  if (lOtherUriP->getAnyUriTypeCode() != STRUCTURAL_INFORMATION_ANY_URI)
+  {
+    store::Item_t lOtherUri;
+    GET_FACTORY().createStructuralAnyURI(lOtherUri,lOtherUriP->theValue.c_str());
+    return inSameCollection(lOtherUri);
+  }
+  else
+  {
+    return
+        (
+        theCollectionId !=0
+        &&
+        theCollectionId == static_cast<StructuralAnyUriItem *>(aOther.getp())->theCollectionId
+        );
+
+  }
+}
+
 
 /*******************************************************************************
   class StringItem

=== modified file 'src/store/naive/atomic_items.h'
--- src/store/naive/atomic_items.h	2011-09-30 14:06:33 +0000
+++ src/store/naive/atomic_items.h	2011-10-06 09:58:24 +0000
@@ -38,6 +38,7 @@
 #include "zorbatypes/datetime.h"
 
 #include "diagnostics/xquery_diagnostics.h"
+#include "store/naive/ordpath.h"
 
 
 namespace zorba
@@ -46,6 +47,13 @@
 namespace simplestore
 {
 
+
+enum AnyUriTypeCode
+{
+  NON_SPECIALIZED_ANY_URI,
+  STRUCTURAL_INFORMATION_ANY_URI
+};
+
 class AtomicItemTokenizerCallback;
 
 class QNameItem;
@@ -483,6 +491,7 @@
 class AnyUriItem : public AtomicItem
 {
   friend class BasicItemFactory;
+  friend class StructuralAnyUriItem;
 
 protected:
   zstring theValue;
@@ -493,6 +502,8 @@
   AnyUriItem() {}
 
 public:
+  virtual AnyUriTypeCode getAnyUriTypeCode() const {return NON_SPECIALIZED_ANY_URI;}
+
   SchemaTypeCode getTypeCode() const { return XS_ANY_URI; }
 
   store::Item* getType( ) const;
@@ -526,8 +537,163 @@
   const zstring& getString() const { return theValue; }
 
   zstring show() const;
-};
-
+
+  virtual bool
+  isAncestor(const store::Item_t&) const;
+
+  virtual bool
+  isFollowingSibling(const store::Item_t&) const;
+
+  virtual bool
+  isFollowing(const store::Item_t&) const;
+
+  virtual bool
+  isDescendant(const store::Item_t&) const;
+
+  virtual bool
+  isPrecedingSibling(const store::Item_t&) const;
+
+  virtual bool
+  isPreceding(const store::Item_t&) const;
+
+  virtual bool
+  isChild(const store::Item_t&) const;
+
+  virtual bool
+  isAttribute(const store::Item_t&) const;
+
+  virtual bool
+  isParent(const store::Item_t&) const;
+
+  virtual bool
+  isPrecedingInDocumentOrder(const store::Item_t&) const;
+
+  virtual bool
+  isFollowingInDocumentOrder(const store::Item_t&) const;
+
+  virtual store::Item_t
+  getLevel() const;
+
+  virtual bool
+  isAttribute() const;
+
+  virtual bool
+  isComment() const;
+
+  virtual bool
+  isDocument() const;
+
+  virtual bool
+  isElement() const;
+
+  virtual bool
+  isProcessingInstruction() const;
+
+  virtual bool
+  isText() const;
+
+  virtual bool
+  isSibling(const store::Item_t&) const;
+
+  virtual bool
+  inSameTree(const store::Item_t&) const;
+
+  virtual bool
+  inCollection() const;
+
+  virtual bool
+  inSameCollection(const store::Item_t&) const;
+};
+
+/*******************************************************************************
+  class StructuralAnyUriItem
+********************************************************************************/
+class StructuralAnyUriItem : public AnyUriItem
+{
+  friend class BasicItemFactory;
+
+protected:
+  ulong theCollectionId;
+  ulong theTreeId;
+  store::StoreConsts::NodeKind theNodeKind;
+  OrdPath theOrdPath;
+
+protected:
+  virtual AnyUriTypeCode getAnyUriTypeCode() const {return STRUCTURAL_INFORMATION_ANY_URI;}
+
+  StructuralAnyUriItem(zstring& value);
+
+  StructuralAnyUriItem(zstring& value, ulong collectionId, ulong treeId, store::StoreConsts::NodeKind nodeKind, const OrdPath& ordPath);
+
+  StructuralAnyUriItem() {}
+
+public:
+  bool
+  isAncestor(const store::Item_t&) const;
+
+  bool
+  isFollowingSibling(const store::Item_t&) const;
+
+  bool
+  isFollowing(const store::Item_t&) const;
+
+  bool
+  isDescendant(const store::Item_t&) const;
+
+  bool
+  isPrecedingSibling(const store::Item_t&) const;
+
+  bool
+  isPreceding(const store::Item_t&) const;
+
+  bool
+  isChild(const store::Item_t&) const;
+
+  bool
+  isAttribute(const store::Item_t&) const;
+
+  bool
+  isParent(const store::Item_t&) const;
+
+  bool
+  isPrecedingInDocumentOrder(const store::Item_t&) const;
+
+  bool
+  isFollowingInDocumentOrder(const store::Item_t&) const;
+
+  store::Item_t
+  getLevel() const;
+
+  bool
+  isAttribute() const;
+
+  bool
+  isComment() const;
+
+  bool
+  isDocument() const;
+
+  bool
+  isElement() const;
+
+  bool
+  isProcessingInstruction() const;
+
+  bool
+  isText() const;
+
+  bool
+  isSibling(const store::Item_t&) const;
+
+  bool
+  inSameTree(const store::Item_t&) const;
+
+  bool
+  inCollection() const;
+
+  bool
+  inSameCollection(const store::Item_t&) const;
+};
 
 /*******************************************************************************
   class StringItem

=== modified file 'src/store/naive/item.cpp'
--- src/store/naive/item.cpp	2011-08-23 23:18:43 +0000
+++ src/store/naive/item.cpp	2011-10-06 09:58:24 +0000
@@ -1063,6 +1063,15 @@
 }
 
 bool
+Item::isAttribute(const store::Item_t&) const
+{
+  throw ZORBA_EXCEPTION(
+    zerr::ZSTR0050_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE,
+    ERROR_PARAMS( __FUNCTION__, getType()->getStringValue() )
+  );
+}
+
+bool
 Item::isParent(const store::Item_t&) const
 {
   throw ZORBA_EXCEPTION(
@@ -1071,6 +1080,24 @@
   );
 }
 
+bool
+Item::isPrecedingInDocumentOrder(const store::Item_t&) const
+{
+  throw ZORBA_EXCEPTION(
+    zerr::ZSTR0050_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE,
+    ERROR_PARAMS( __FUNCTION__, getType()->getStringValue() )
+  );
+}
+
+bool
+Item::isFollowingInDocumentOrder(const store::Item_t&) const
+{
+  throw ZORBA_EXCEPTION(
+    zerr::ZSTR0050_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE,
+    ERROR_PARAMS( __FUNCTION__, getType()->getStringValue() )
+  );
+}
+
 store::Item_t
 Item::getLevel() const
 {
@@ -1080,6 +1107,97 @@
   );
 }
 
+bool
+Item::isSibling(const store::Item_t&) const
+{
+  throw ZORBA_EXCEPTION(
+    zerr::ZSTR0050_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE,
+    ERROR_PARAMS( __FUNCTION__, getType()->getStringValue() )
+  );
+}
+
+bool
+Item::isAttribute() const
+{
+  throw ZORBA_EXCEPTION(
+    zerr::ZSTR0050_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE,
+    ERROR_PARAMS( __FUNCTION__, getType()->getStringValue() )
+  );
+}
+
+bool
+Item::isComment() const
+{
+  throw ZORBA_EXCEPTION(
+    zerr::ZSTR0050_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE,
+    ERROR_PARAMS( __FUNCTION__, getType()->getStringValue() )
+  );
+}
+
+bool
+Item::isDocument() const
+{
+  throw ZORBA_EXCEPTION(
+    zerr::ZSTR0050_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE,
+    ERROR_PARAMS( __FUNCTION__, getType()->getStringValue() )
+  );
+}
+
+
+bool
+Item::isElement() const
+{
+  throw ZORBA_EXCEPTION(
+    zerr::ZSTR0050_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE,
+    ERROR_PARAMS( __FUNCTION__, getType()->getStringValue() )
+  );
+}
+
+bool
+Item::isProcessingInstruction() const
+{
+  throw ZORBA_EXCEPTION(
+    zerr::ZSTR0050_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE,
+    ERROR_PARAMS( __FUNCTION__, getType()->getStringValue() )
+  );
+}
+
+bool
+Item::isText() const
+{
+  throw ZORBA_EXCEPTION(
+    zerr::ZSTR0050_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE,
+    ERROR_PARAMS( __FUNCTION__, getType()->getStringValue() )
+  );
+}
+
+bool
+Item::inSameTree(const store::Item_t&) const
+{
+  throw ZORBA_EXCEPTION(
+    zerr::ZSTR0050_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE,
+    ERROR_PARAMS( __FUNCTION__, getType()->getStringValue() )
+  );
+}
+
+bool
+Item::inCollection() const
+{
+  throw ZORBA_EXCEPTION(
+    zerr::ZSTR0050_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE,
+    ERROR_PARAMS( __FUNCTION__, getType()->getStringValue() )
+  );
+}
+
+bool
+Item::inSameCollection(const store::Item_t&) const
+{
+  throw ZORBA_EXCEPTION(
+    zerr::ZSTR0050_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE,
+    ERROR_PARAMS( __FUNCTION__, getType()->getStringValue() )
+  );
+}
+
 store::Item_t
 Item::leastCommonAncestor(const store::Item_t&) const
 {

=== modified file 'src/store/naive/node_items.cpp'
--- src/store/naive/node_items.cpp	2011-10-03 08:49:55 +0000
+++ src/store/naive/node_items.cpp	2011-10-06 09:58:24 +0000
@@ -1138,7 +1138,7 @@
   Return the position of the given node among the children of "this". If the
   given node is not a child of "this", return the number of children of "this".
 ********************************************************************************/
-csize InternalNode::findChild(XmlNode* child) const
+csize InternalNode::findChild(const XmlNode* child) const
 {
   const_iterator begin = childrenBegin();
   const_iterator end = childrenEnd();

=== modified file 'src/store/naive/node_items.h'
--- src/store/naive/node_items.h	2011-09-23 14:26:00 +0000
+++ src/store/naive/node_items.h	2011-10-06 09:58:24 +0000
@@ -544,6 +544,7 @@
   friend class TextNode;
   friend class PiNode;
   friend class CommentNode;
+  friend class SimpleStore;
 
 protected:
   OrdPath           theOrdPath;
@@ -624,6 +625,7 @@
   friend class CommentNode;
   friend class UpdPut;
   friend class CollectionPul;
+  friend class SimpleStore;
 
 public:
   typedef std::vector<XmlNode*> NodeVector;
@@ -721,7 +723,7 @@
   void finalizeNode();
 
 protected:
-  csize findChild(XmlNode* child) const;
+  csize findChild(const XmlNode* child) const;
 
   void insertChild(XmlNode* child, csize pos);
 

=== modified file 'src/store/naive/ordpath.cpp'
--- src/store/naive/ordpath.cpp	2011-06-14 17:26:33 +0000
+++ src/store/naive/ordpath.cpp	2011-10-06 09:58:24 +0000
@@ -614,6 +614,62 @@
   }
 }
 
+/*******************************************************************************
+ Determine the position of the "other" ordpath relative to "this" ordpath.
+ The result is one of: PRECEDING_SIBLING, FOLLOWING_SIBLING, PARENT, CHILD or OTHER
+********************************************************************************/
+OrdPath::RelativePosition2 OrdPath::getRelativePosition2(const OrdPath& other) const
+{
+  int32_t dewey1[MAX_NUM_COMPS], dewey2[MAX_NUM_COMPS];
+  ulong offsets1[MAX_NUM_COMPS], offsets2[MAX_NUM_COMPS];
+  ulong numComps1 = 0,numComps2 = 0;
+  ulong bitLen1 = 0,bitLen2 = 0;
+  bool thisFirst;
+
+  decompress(0,dewey1,offsets1,numComps1,bitLen1);
+  other.decompress(0,dewey2,offsets2,numComps2,bitLen2);
+
+  ulong curr=0; //curr will be the first non-shared component
+  if (numComps1<numComps2)
+  {
+    while (curr<numComps1 && dewey1[curr]==dewey2[curr])
+      ++curr;
+  }
+  else
+  {
+    while (curr<numComps2 && dewey1[curr]==dewey2[curr])
+      ++curr;
+    //curr is the first non-shared component
+    if (curr==numComps1 && numComps1==numComps2)
+      return OTHER; //The two ordpaths are the same
+  }
+  if (curr<numComps1 && curr<numComps2 && dewey1[curr]<dewey2[curr])
+    thisFirst=true;
+  else
+    thisFirst=false;
+
+  ulong extraLevels1=0, extraLevels2=0;
+  for (ulong i=curr;i<numComps1;++i)
+    if (dewey1[i] % 2 == 1)
+      ++extraLevels1;
+
+  for (ulong i=curr;i<numComps2;++i)
+    if (dewey2[i] % 2 == 1)
+      ++extraLevels2;
+
+  if (extraLevels1>1 || extraLevels2>1)
+    return OTHER;
+  else if (extraLevels1==1 && extraLevels2==0)
+    return PARENT;
+  else if (extraLevels1==0 && extraLevels2==1)
+    return CHILD;
+  else if (extraLevels1==1 && extraLevels2==1)
+    return thisFirst ? FOLLOWING_SIBLING : PRECEDING_SIBLING;
+
+  ZORBA_FATAL(0,"");//The last component of an OrdPath is odd.
+                    //Since the two labels were different at least one
+                    //of the two must have a odd component left.
+}
 
 /*******************************************************************************
   Compress a dewey id into an ordpath.
@@ -1466,6 +1522,22 @@
 }
 
 
+ulong OrdPath::getLevel() const
+{
+  int32_t dewey[MAX_NUM_COMPS];
+  ulong offsets[MAX_NUM_COMPS];
+  ulong numComps = 0;
+  ulong bitLen = 0;
+  decompress(0,dewey,offsets,numComps,bitLen);
+
+  ulong level=0;
+  for (ulong i=0;i<numComps;++i)
+    if (dewey[i] % 2==1)
+      ++level;
+  return level;
+}
+
+
 /*******************************************************************************
   Decompress all the components that appear after a given starting offset
   within the ordpath data buffer (it is assumed that startOffset points to

=== modified file 'src/store/naive/ordpath.h'
--- src/store/naive/ordpath.h	2011-06-14 17:26:33 +0000
+++ src/store/naive/ordpath.h	2011-10-06 09:58:24 +0000
@@ -31,6 +31,7 @@
 namespace zorba { namespace simplestore {
 
 class OrdPathStack;
+class Reference;
 
 
 /*******************************************************************************
@@ -52,6 +53,16 @@
   }
   RelativePosition;
 
+  typedef enum
+  {
+      PRECEDING_SIBLING,
+      FOLLOWING_SIBLING,
+      PARENT,
+      CHILD,
+      OTHER
+  }
+  RelativePosition2;
+
 
   typedef std::vector<int32_t> DeweyID;
 
@@ -182,6 +193,10 @@
 
   RelativePosition getRelativePosition(const OrdPath& other) const;
 
+  RelativePosition2 getRelativePosition2(const OrdPath& other) const;
+
+  ulong getLevel() const;
+
   void compress(const DeweyID& dewey);
 
   void appendComp(int32_t value);

=== modified file 'src/store/naive/simple_item_factory.cpp'
--- src/store/naive/simple_item_factory.cpp	2011-07-22 07:23:17 +0000
+++ src/store/naive/simple_item_factory.cpp	2011-10-06 09:58:24 +0000
@@ -105,6 +105,38 @@
   return true;
 }
 
+bool BasicItemFactory::createStructuralAnyURI(store::Item_t& result, zstring& value)
+{
+  zstring str = value;
+  theUriPool->insert(str);
+  result =  new StructuralAnyUriItem(str);
+  return true;
+}
+
+
+bool BasicItemFactory::createStructuralAnyURI(store::Item_t& result, const char* value)
+{
+  zstring str;
+  theUriPool->insertc(value, str);
+  result = new StructuralAnyUriItem(str);
+  return true;
+}
+
+bool BasicItemFactory::createStructuralAnyURI(store::Item_t& result, ulong collectionId, ulong treeId, store::StoreConsts::NodeKind nodeKind, const OrdPath& ordPath)
+{
+  ZORBA_FATAL(nodeKind,"Unexpected node kind");
+  std::ostringstream stream;
+  stream   << "zorba:"
+           << collectionId << "."
+           << treeId << "."
+           << static_cast<int>(nodeKind) << "."
+           << ordPath.serialize();
+  zstring uri = stream.str();
+
+  theUriPool->insert(uri);
+  result = new StructuralAnyUriItem(uri,collectionId,treeId,nodeKind,ordPath);
+  return true;
+}
 
 bool BasicItemFactory::createString(store::Item_t& result, zstring& value)
 {

=== modified file 'src/store/naive/simple_item_factory.h'
--- src/store/naive/simple_item_factory.h	2011-07-22 07:23:17 +0000
+++ src/store/naive/simple_item_factory.h	2011-10-06 09:58:24 +0000
@@ -41,6 +41,7 @@
 class StringPool;
 typedef StringPool UriPool;
 class QNamePool;
+class OrdPath;
 
 
 class BasicItemFactory : public store::ItemFactory
@@ -78,6 +79,12 @@
 
   bool createAnyURI(store::Item_t& result, const char* value);
 
+  bool createStructuralAnyURI(store::Item_t& result, zstring& value);
+
+  bool createStructuralAnyURI(store::Item_t& result, const char* value);
+
+  bool createStructuralAnyURI(store::Item_t& result, ulong collectionId, ulong treeId, store::StoreConsts::NodeKind nodeKind, const OrdPath& ordPath);
+
   bool createUntypedAtomic(store::Item_t& result, zstring& value);
 
   bool createString(store::Item_t& result, zstring& value);

=== modified file 'src/store/naive/simple_store.cpp'
--- src/store/naive/simple_store.cpp	2011-10-03 08:49:55 +0000
+++ src/store/naive/simple_store.cpp	2011-10-06 09:58:24 +0000
@@ -57,6 +57,7 @@
 #include "store/naive/pul_primitive_factory.h"
 
 #include "util/cxx_util.h"
+#include "util/uuid/uuid.h"
 
 #ifndef ZORBA_NO_FULL_TEXT
 #include "runtime/full_text/default_tokenizer.h"
@@ -1669,6 +1670,104 @@
   }
 }
 
+/*******************************************************************************
+  Computes the Structural Reference for the given node.
+********************************************************************************/
+bool SimpleStore::getStructuralInformation(store::Item_t& result, const store::Item* node)
+{
+#ifdef TEXT_ORDPATH
+  const OrdPathNode* n = static_cast<const OrdPathNode*>(node);
+  return theItemFactory->createStructuralAnyURI
+      (
+          result,
+          n->getCollectionId(),
+          n->getTreeId(),
+          n->getNodeKind(),
+          n->getOrdPath()
+      );
+#else
+  if (node->getNodeKind() == store::StoreConsts::textNode)
+  {
+    OrdPath ordPath;
+    InternalNode* parent = static_cast<InternalNode*>(node->getParent());
+    const TextNode* textChild = static_cast<const TextNode *>(node);
+
+    if (parent == NULL) //The text node is the root
+    {
+      ordPath.setAsRoot();
+      ordPath.appendComp(1);
+    }
+    else
+    {
+      ZORBA_FATAL(parent->theOrdPath.isValid(),"Parent ordpath is invalid.");
+      ElementNode* elemParent = NULL;
+      csize pos=parent->findChild(textChild);
+      csize numChildren = parent->numChildren();
+      csize numAttrs = 0;
+
+      if (parent->getNodeKind() == store::StoreConsts::elementNode)
+      {
+        elemParent = reinterpret_cast<ElementNode*>(parent);
+        numAttrs =  elemParent->numAttrs();
+      }
+
+      if (numChildren==1 && numAttrs==0) // Parent has no other children and no attributes
+      {
+        ordPath = parent->theOrdPath;
+        ordPath.appendComp(1);
+      }
+      else //Parent has either children or attributes
+      {
+        const OrdPath* upperOrdPath = NULL; //The smallest Ordpath at the same level of the textNode
+                                            //which must be greater than the OrdPath of the textNode
+        const OrdPath* lowerOrdPath = NULL; //The biggest Ordpath at the same level of the textNode
+                                            //which must be smaller than the OrdPath of the textNode
+
+        if (pos < numChildren-1) //There could be an upperOrdPath
+          upperOrdPath = parent->getFirstChildOrdPathAfter(pos);
+
+        if (pos > 0) //There could be a lowerOrdPath in the children
+          lowerOrdPath = parent->getFirstChildOrdPathBefore(pos-1);
+
+        if (lowerOrdPath == NULL && numAttrs > 0) //There is a lowerOrdPath in the attributes
+          lowerOrdPath = &elemParent->getAttr(numAttrs-1)->theOrdPath;
+
+        if (upperOrdPath != NULL && lowerOrdPath != NULL)
+          OrdPath::insertInto(parent->theOrdPath, *lowerOrdPath, *upperOrdPath, ordPath);
+        else if (upperOrdPath == NULL && lowerOrdPath != NULL)
+          OrdPath::insertAfter(parent->theOrdPath, *lowerOrdPath, ordPath);
+        else if (upperOrdPath != NULL && lowerOrdPath == NULL)
+          OrdPath::insertBefore(parent->theOrdPath, *upperOrdPath, ordPath);
+        else
+          ZORBA_FATAL(0,"Adjacent text nodes.");
+      }
+    }
+    return theItemFactory->createStructuralAnyURI
+        (
+            result,
+            textChild->getCollectionId(),
+            textChild->getTreeId(),
+            store::StoreConsts::textNode,
+            ordPath
+        );
+  }
+  else
+  {
+    const OrdPathNode* n = static_cast<const OrdPathNode*>(node);
+    return theItemFactory->createStructuralAnyURI
+        (
+            result,
+            n->getCollectionId(),
+            n->getTreeId(),
+            n->getNodeKind(),
+            n->getOrdPath()
+        );
+  }
+#endif
+}
+
+
+
 
 /*******************************************************************************
 

=== modified file 'src/store/naive/simple_store.h'
--- src/store/naive/simple_store.h	2011-09-26 22:49:54 +0000
+++ src/store/naive/simple_store.h	2011-10-06 09:58:24 +0000
@@ -332,6 +332,8 @@
 
   bool getNodeByReference(store::Item_t& result, const store::Item* uri);
 
+  bool getStructuralInformation(store::Item_t& result, const store::Item* node);
+
   store::TempSeq_t createTempSeq(bool lazy);
 
   store::TempSeq_t createTempSeq(

=== added file 'test/rbkt/ExpQueryResults/zorba/nodes/structural_1.xml.res'
--- test/rbkt/ExpQueryResults/zorba/nodes/structural_1.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/nodes/structural_1.xml.res	2011-10-06 09:58:24 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<result><ancestor-of>true true false false false false</ancestor-of><following-sibling-of>true true false false false false false</following-sibling-of><following-of>true false false false false</following-of><descendant-of>true true false false false false</descendant-of><preceding-sibling-of>true true false false false false false</preceding-sibling-of><preceding-of>true false false false false</preceding-of></result>
\ No newline at end of file

=== added file 'test/rbkt/ExpQueryResults/zorba/nodes/structural_1_parsed.xml.res'
--- test/rbkt/ExpQueryResults/zorba/nodes/structural_1_parsed.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/nodes/structural_1_parsed.xml.res	2011-10-06 09:58:24 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<result><ancestor-of>true true false false false false</ancestor-of><following-sibling-of>true true false false false false false</following-sibling-of><following-of>true false false false false</following-of><descendant-of>true true false false false false</descendant-of><preceding-sibling-of>true true false false false false false</preceding-sibling-of><preceding-of>true false false false false</preceding-of></result>
\ No newline at end of file

=== added file 'test/rbkt/ExpQueryResults/zorba/nodes/structural_2.xml.res'
--- test/rbkt/ExpQueryResults/zorba/nodes/structural_2.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/nodes/structural_2.xml.res	2011-10-06 09:58:24 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<result><child-of>true true false false false false false</child-of><attribute-of>true false false false false false false false</attribute-of><parent-of>true true false false false false false</parent-of><preceding-in-document-order-of>true true true true false false false false false</preceding-in-document-order-of><following-in-document-order-of>true true true true false false false false false</following-in-document-order-of><level>2 3 3 3 4 4</level><sibling-of>true true true false false false false</sibling-of><in-same-tree-of>true true false false</in-same-tree-of><in-collection>true true true true false false false false</in-collection><in-same-collection>true true true true false false false false false</in-same-collection></result>
\ No newline at end of file

=== added file 'test/rbkt/ExpQueryResults/zorba/nodes/structural_2_parsed.xml.res'
--- test/rbkt/ExpQueryResults/zorba/nodes/structural_2_parsed.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/nodes/structural_2_parsed.xml.res	2011-10-06 09:58:24 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<result><child-of>true true false false false false false</child-of><attribute-of>true false false false false false false false</attribute-of><parent-of>true true false false false false false</parent-of><preceding-in-document-order-of>true true true true false false false false false</preceding-in-document-order-of><following-in-document-order-of>true true true true false false false false false</following-in-document-order-of><level>2 3 3 3 4 4</level><sibling-of>true true true false false false false</sibling-of><in-same-tree-of>true true false false</in-same-tree-of><in-collection>true true true true false false false false</in-collection><in-same-collection>true true true true false false false false false</in-same-collection></result>
\ No newline at end of file

=== added file 'test/rbkt/ExpQueryResults/zorba/nodes/structural_3.xml.res'
--- test/rbkt/ExpQueryResults/zorba/nodes/structural_3.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/nodes/structural_3.xml.res	2011-10-06 09:58:24 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<result><attr>true false false false false false</attr><comm>false true false false false false</comm><docu>false false true false false false</docu><elem>false false false true false false</elem><proc>false false false false true false</proc><text>false false false false false true</text></result>
\ No newline at end of file

=== added file 'test/rbkt/ExpQueryResults/zorba/nodes/structural_3_parsed.xml.res'
--- test/rbkt/ExpQueryResults/zorba/nodes/structural_3_parsed.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/nodes/structural_3_parsed.xml.res	2011-10-06 09:58:24 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<result><attr>true false false false false false</attr><comm>false true false false false false</comm><docu>false false true false false false</docu><elem>false false false true false false</elem><proc>false false false false true false</proc><text>false false false false false true</text></result>
\ No newline at end of file

=== added file 'test/rbkt/ExpQueryResults/zorba/nodes/structural_4.xml.res'
--- test/rbkt/ExpQueryResults/zorba/nodes/structural_4.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/nodes/structural_4.xml.res	2011-10-06 09:58:24 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<result><test1>OK: ref:50</test1><test2>OK: ref:5a</test2><test3>OK: ref:5c80</test3><test4>OK: ref:5c80</test4><test5>OK: ref:5d80</test5><test6>OK: ref:5a</test6><test7>OK: ref:5c80</test7><test8>OK: ref:5c80</test8><test9>OK: ref:5d80</test9><test10>OK: ref:5880</test10><test11>OK: ref:5c20</test11><test12>OK: ref:5c20</test12><test13>OK: ref:5d20</test13></result>
\ No newline at end of file

=== added file 'test/rbkt/ExpQueryResults/zorba/nodes/structural_4_parsed.xml.res'
--- test/rbkt/ExpQueryResults/zorba/nodes/structural_4_parsed.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/nodes/structural_4_parsed.xml.res	2011-10-06 09:58:24 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<result><test1>OK: ref:50</test1><test2>OK: ref:5a</test2><test3>OK: ref:5c80</test3><test4>OK: ref:5c80</test4><test5>OK: ref:5d80</test5><test6>OK: ref:5a</test6><test7>OK: ref:5c80</test7><test8>OK: ref:5c80</test8><test9>OK: ref:5d80</test9><test10>OK: ref:5880</test10><test11>OK: ref:5c20</test11><test12>OK: ref:5c20</test12><test13>OK: ref:5d20</test13></result>
\ No newline at end of file

=== added file 'test/rbkt/Queries/zorba/nodes/structural.xml'
--- test/rbkt/Queries/zorba/nodes/structural.xml	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/nodes/structural.xml	2011-10-06 09:58:24 +0000
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<a><b/><b/><b/><b attr="" attr2=""><c attr=""/><c/><c/><c/></b></a>
+<!-- 
+<a>
+    <b/>
+    <b/>
+    <b/>
+    <b attr="" attr2="">
+        <c attr=""/>
+        <c/>
+        <c/>
+        <c/>
+    </b>
+</a>
+ -->
\ No newline at end of file

=== added file 'test/rbkt/Queries/zorba/nodes/structural_1.xq'
--- test/rbkt/Queries/zorba/nodes/structural_1.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/nodes/structural_1.xq	2011-10-06 09:58:24 +0000
@@ -0,0 +1,70 @@
+import module namespace ref = "http://www.zorba-xquery.com/modules/node-structural-information";;
+
+
+variable $x :=  doc("structural.xml")/a;
+insert node <newb><c/></newb> before $x/b[4];
+insert node <newb><c/></newb> after $x/b[4];
+variable $y :=  element {"x"}{$x}/*;
+
+<result>
+  <ancestor-of>
+  {
+    ref:ancestor-of(ref:node-structural-information($x/b[1]), ref:node-structural-information($x)),
+    ref:ancestor-of(ref:node-structural-information($x/b[4]/c[1]), ref:node-structural-information($x)),
+    ref:ancestor-of(ref:node-structural-information($x), ref:node-structural-information($x/b[1])),
+    ref:ancestor-of(ref:node-structural-information($x), ref:node-structural-information($x/b[4]/c[1])),
+    ref:ancestor-of(ref:node-structural-information($x), ref:node-structural-information($x)),
+    ref:ancestor-of(ref:node-structural-information($x/b[1]), ref:node-structural-information($y))
+  }
+  </ancestor-of>
+  <following-sibling-of>
+  {   
+    ref:following-sibling-of(ref:node-structural-information($x/b[1]), ref:node-structural-information($x/b[2])),
+    ref:following-sibling-of(ref:node-structural-information($x/b[1]), ref:node-structural-information($x/newb[1])),
+    ref:following-sibling-of(ref:node-structural-information($x/b[2]), ref:node-structural-information($x/b[1])),
+    ref:following-sibling-of(ref:node-structural-information($x), ref:node-structural-information($x)),
+    ref:following-sibling-of(ref:node-structural-information($x/b/@attr), ref:node-structural-information($x/b/@attr2)),
+    ref:following-sibling-of(ref:node-structural-information($x/b/@attr2), ref:node-structural-information($x/b/@attr)),
+    ref:following-sibling-of(ref:node-structural-information($x/b[1]), ref:node-structural-information($y/b[2]))
+  }
+  </following-sibling-of>
+  <following-of>
+  { 
+    ref:following-of(ref:node-structural-information($x/b[1]), ref:node-structural-information($x/b[4]/c[1])),
+    ref:following-of(ref:node-structural-information($x/b[4]), ref:node-structural-information($x/b[4]/c[1])),
+    ref:following-of(ref:node-structural-information($x/b[4]/c[1]), ref:node-structural-information($x/b[1])),
+    ref:following-of(ref:node-structural-information($x), ref:node-structural-information($x)),
+    ref:following-of(ref:node-structural-information($x/b[1]), ref:node-structural-information($y/b[4]/c[1]))
+  }
+  </following-of>
+  <descendant-of>
+  {        
+    ref:descendant-of(ref:node-structural-information($x), ref:node-structural-information($x/b[1])),
+    ref:descendant-of(ref:node-structural-information($x), ref:node-structural-information($x/b[4]/c[1])),
+    ref:descendant-of(ref:node-structural-information($x/b[1]), ref:node-structural-information($x)),
+    ref:descendant-of(ref:node-structural-information($x/b[4]/c[1]), ref:node-structural-information($x)),    
+    ref:descendant-of(ref:node-structural-information($x), ref:node-structural-information($x)),
+    ref:descendant-of(ref:node-structural-information($x), ref:node-structural-information($y/b[1]))
+  }
+  </descendant-of>
+  <preceding-sibling-of>
+  { 
+    ref:preceding-sibling-of(ref:node-structural-information($x/b[2]), ref:node-structural-information($x/b[1])),
+    ref:preceding-sibling-of(ref:node-structural-information($x/b[4]), ref:node-structural-information($x/newb[1])),
+    ref:preceding-sibling-of(ref:node-structural-information($x/b[1]), ref:node-structural-information($x/b[2])),
+    ref:preceding-sibling-of(ref:node-structural-information($x), ref:node-structural-information($x)),
+    ref:preceding-sibling-of(ref:node-structural-information($x/b/@attr), ref:node-structural-information($x/b/@attr2)),
+    ref:preceding-sibling-of(ref:node-structural-information($x/b/@attr2), ref:node-structural-information($x/b/@attr)),
+    ref:preceding-sibling-of(ref:node-structural-information($x/b[2]), ref:node-structural-information($y/b[1]))
+  }
+  </preceding-sibling-of>
+  <preceding-of>
+  {
+    ref:preceding-of(ref:node-structural-information($x/b[4]/c[1]), ref:node-structural-information($x/b[1])),
+    ref:preceding-of(ref:node-structural-information($x/b[1]), ref:node-structural-information($x/b[4]/c[1])),
+    ref:preceding-of(ref:node-structural-information($x/b[4]), ref:node-structural-information($x/b[4]/c[1])),    
+    ref:preceding-of(ref:node-structural-information($x), ref:node-structural-information($x)),
+    ref:preceding-of(ref:node-structural-information($x/b[4]/c[1]), ref:node-structural-information($y/b[1]))
+  }
+  </preceding-of>
+</result>   

=== added file 'test/rbkt/Queries/zorba/nodes/structural_1_parsed.xq'
--- test/rbkt/Queries/zorba/nodes/structural_1_parsed.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/nodes/structural_1_parsed.xq	2011-10-06 09:58:24 +0000
@@ -0,0 +1,70 @@
+import module namespace ref = "http://www.zorba-xquery.com/modules/node-structural-information";;
+
+
+variable $x :=  doc("structural.xml")/a;
+insert node <newb><c/></newb> before $x/b[4];
+insert node <newb><c/></newb> after $x/b[4];
+variable $y :=  element {"x"}{$x}/*;
+
+<result>
+  <ancestor-of>
+  {
+    ref:ancestor-of(xs:anyURI(string(ref:node-structural-information($x/b[1]))), xs:anyURI(string(ref:node-structural-information($x)))),
+    ref:ancestor-of(xs:anyURI(string(ref:node-structural-information($x/b[4]/c[1]))), xs:anyURI(string(ref:node-structural-information($x)))),
+    ref:ancestor-of(xs:anyURI(string(ref:node-structural-information($x))), xs:anyURI(string(ref:node-structural-information($x/b[1])))),
+    ref:ancestor-of(xs:anyURI(string(ref:node-structural-information($x))), xs:anyURI(string(ref:node-structural-information($x/b[4]/c[1])))),
+    ref:ancestor-of(xs:anyURI(string(ref:node-structural-information($x))), xs:anyURI(string(ref:node-structural-information($x)))),
+    ref:ancestor-of(xs:anyURI(string(ref:node-structural-information($x/b[1]))), xs:anyURI(string(ref:node-structural-information($y))))
+  }
+  </ancestor-of>
+  <following-sibling-of>
+  {   
+    ref:following-sibling-of(xs:anyURI(string(ref:node-structural-information($x/b[1]))), xs:anyURI(string(ref:node-structural-information($x/b[2])))),
+    ref:following-sibling-of(xs:anyURI(string(ref:node-structural-information($x/b[1]))), xs:anyURI(string(ref:node-structural-information($x/newb[1])))),
+    ref:following-sibling-of(xs:anyURI(string(ref:node-structural-information($x/b[2]))), xs:anyURI(string(ref:node-structural-information($x/b[1])))),
+    ref:following-sibling-of(xs:anyURI(string(ref:node-structural-information($x))), xs:anyURI(string(ref:node-structural-information($x)))),
+    ref:following-sibling-of(xs:anyURI(string(ref:node-structural-information($x/b/@attr))), xs:anyURI(string(ref:node-structural-information($x/b/@attr2)))),
+    ref:following-sibling-of(xs:anyURI(string(ref:node-structural-information($x/b/@attr2))), xs:anyURI(string(ref:node-structural-information($x/b/@attr)))),
+    ref:following-sibling-of(xs:anyURI(string(ref:node-structural-information($x/b[1]))), xs:anyURI(string(ref:node-structural-information($y/b[2]))))
+  }
+  </following-sibling-of>
+  <following-of>
+  { 
+    ref:following-of(xs:anyURI(string(ref:node-structural-information($x/b[1]))), xs:anyURI(string(ref:node-structural-information($x/b[4]/c[1])))),
+    ref:following-of(xs:anyURI(string(ref:node-structural-information($x/b[4]))), xs:anyURI(string(ref:node-structural-information($x/b[4]/c[1])))),
+    ref:following-of(xs:anyURI(string(ref:node-structural-information($x/b[4]/c[1]))), xs:anyURI(string(ref:node-structural-information($x/b[1])))),
+    ref:following-of(xs:anyURI(string(ref:node-structural-information($x))), xs:anyURI(string(ref:node-structural-information($x)))),
+    ref:following-of(xs:anyURI(string(ref:node-structural-information($x/b[1]))), xs:anyURI(string(ref:node-structural-information($y/b[4]/c[1]))))
+  }
+  </following-of>
+  <descendant-of>
+  {        
+    ref:descendant-of(xs:anyURI(string(ref:node-structural-information($x))), xs:anyURI(string(ref:node-structural-information($x/b[1])))),
+    ref:descendant-of(xs:anyURI(string(ref:node-structural-information($x))), xs:anyURI(string(ref:node-structural-information($x/b[4]/c[1])))),
+    ref:descendant-of(xs:anyURI(string(ref:node-structural-information($x/b[1]))), xs:anyURI(string(ref:node-structural-information($x)))),
+    ref:descendant-of(xs:anyURI(string(ref:node-structural-information($x/b[4]/c[1]))), xs:anyURI(string(ref:node-structural-information($x)))),    
+    ref:descendant-of(xs:anyURI(string(ref:node-structural-information($x))), xs:anyURI(string(ref:node-structural-information($x)))),
+    ref:descendant-of(xs:anyURI(string(ref:node-structural-information($x))), xs:anyURI(string(ref:node-structural-information($y/b[1]))))
+  }
+  </descendant-of>
+  <preceding-sibling-of>
+  { 
+    ref:preceding-sibling-of(xs:anyURI(string(ref:node-structural-information($x/b[2]))), xs:anyURI(string(ref:node-structural-information($x/b[1])))),
+    ref:preceding-sibling-of(xs:anyURI(string(ref:node-structural-information($x/b[4]))), xs:anyURI(string(ref:node-structural-information($x/newb[1])))),
+    ref:preceding-sibling-of(xs:anyURI(string(ref:node-structural-information($x/b[1]))), xs:anyURI(string(ref:node-structural-information($x/b[2])))),
+    ref:preceding-sibling-of(xs:anyURI(string(ref:node-structural-information($x))), xs:anyURI(string(ref:node-structural-information($x)))),
+    ref:preceding-sibling-of(xs:anyURI(string(ref:node-structural-information($x/b/@attr))), xs:anyURI(string(ref:node-structural-information($x/b/@attr2)))),
+    ref:preceding-sibling-of(xs:anyURI(string(ref:node-structural-information($x/b/@attr2))), xs:anyURI(string(ref:node-structural-information($x/b/@attr)))),
+    ref:preceding-sibling-of(xs:anyURI(string(ref:node-structural-information($x/b[2]))), xs:anyURI(string(ref:node-structural-information($y/b[1]))))
+  }
+  </preceding-sibling-of>
+  <preceding-of>
+  {
+    ref:preceding-of(xs:anyURI(string(ref:node-structural-information($x/b[4]/c[1]))), xs:anyURI(string(ref:node-structural-information($x/b[1])))),
+    ref:preceding-of(xs:anyURI(string(ref:node-structural-information($x/b[1]))), xs:anyURI(string(ref:node-structural-information($x/b[4]/c[1])))),
+    ref:preceding-of(xs:anyURI(string(ref:node-structural-information($x/b[4]))), xs:anyURI(string(ref:node-structural-information($x/b[4]/c[1])))),    
+    ref:preceding-of(xs:anyURI(string(ref:node-structural-information($x))), xs:anyURI(string(ref:node-structural-information($x)))),
+    ref:preceding-of(xs:anyURI(string(ref:node-structural-information($x/b[4]/c[1]))), xs:anyURI(string(ref:node-structural-information($y/b[1]))))
+  }
+  </preceding-of>
+</result>
\ No newline at end of file

=== added file 'test/rbkt/Queries/zorba/nodes/structural_2.xq'
--- test/rbkt/Queries/zorba/nodes/structural_2.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/nodes/structural_2.xq	2011-10-06 09:58:24 +0000
@@ -0,0 +1,142 @@
+import module namespace ref = "http://www.zorba-xquery.com/modules/node-structural-information";;
+import module namespace ddl = "http://www.zorba-xquery.com/modules/store/dynamic/collections/ddl";;
+import module namespace dml = "http://www.zorba-xquery.com/modules/store/dynamic/collections/dml";;
+
+ddl:create(xs:QName("ddl:coll"),<dummy/>);
+variable $xx:=dml:collection(xs:QName("ddl:coll"));
+
+ddl:create(xs:QName("ddl:coll2"),<dummy/>);
+variable $yy:=dml:collection(xs:QName("ddl:coll2"));
+
+insert node <b/> into $xx;
+insert node <bb/> into $xx/b;
+insert node <b2/> into $xx;
+insert node <bb2/> into $xx/b2;
+
+insert node <b/> into $yy;
+insert node <bb/> into $yy/b;
+insert node <b2/> into $yy;
+insert node <bb2/> into $yy/b2;
+
+variable $x :=  doc("structural.xml")/a;
+insert node <newb><c/></newb> before $x/b[4];
+insert node <newb><c/></newb> after $x/b[4];
+variable $y :=  element {"x"}{$x}/*;
+
+<result>
+  <child-of>
+  {
+    ref:child-of(ref:node-structural-information($x), ref:node-structural-information($x/b[1])),
+    ref:child-of(ref:node-structural-information($x), ref:node-structural-information($x/newb[1])),
+    ref:child-of(ref:node-structural-information($x), ref:node-structural-information($x/b[4]/c[1])),
+    ref:child-of(ref:node-structural-information($x/b[1]), ref:node-structural-information($x)),
+    ref:child-of(ref:node-structural-information($x/b[4]/c[1]), ref:node-structural-information($x)),    
+    ref:child-of(ref:node-structural-information($x), ref:node-structural-information($x)),
+    ref:child-of(ref:node-structural-information($x/b[1]), ref:node-structural-information($y))
+  }
+  </child-of>
+  <attribute-of>
+  {
+    ref:attribute-of(ref:node-structural-information($x/b[4]), ref:node-structural-information($x/b[4]/@attr)),
+    ref:attribute-of(ref:node-structural-information($x/b[4]), ref:node-structural-information($x/b[4]/c/@attr)),
+    ref:attribute-of(ref:node-structural-information($x/b[4]/@attr), ref:node-structural-information($x/b[4])),
+    ref:attribute-of(ref:node-structural-information($x/b[4]/c/@attr), ref:node-structural-information($x/b[4])),    
+    ref:attribute-of(ref:node-structural-information($x), ref:node-structural-information($x/b[1])),
+    ref:attribute-of(ref:node-structural-information($x), ref:node-structural-information($x/newb[1])),    
+    ref:attribute-of(ref:node-structural-information($x/b[4]/@attr), ref:node-structural-information($x/b[4]/@attr)),
+    ref:attribute-of(ref:node-structural-information($x/b[4]), ref:node-structural-information($y/b[4]/@attr))
+  }
+  </attribute-of>
+  <parent-of>
+  { 
+    ref:parent-of(ref:node-structural-information($x/b[1]), ref:node-structural-information($x)),
+    ref:parent-of(ref:node-structural-information($x/newb[1]), ref:node-structural-information($x)),
+    ref:parent-of(ref:node-structural-information($x/b[4]/c[1]), ref:node-structural-information($x)),
+    ref:parent-of(ref:node-structural-information($x), ref:node-structural-information($x/b[1])),
+    ref:parent-of(ref:node-structural-information($x), ref:node-structural-information($x/b[4]/c[1])),        
+    ref:parent-of(ref:node-structural-information($x), ref:node-structural-information($x)),
+    ref:parent-of(ref:node-structural-information($x/b[1]), ref:node-structural-information($y))
+  }
+  </parent-of>
+  <preceding-in-document-order-of>
+  {
+    ref:preceding-in-document-order-of(ref:node-structural-information($x/b[4]/@attr), ref:node-structural-information($x/b[1])),
+    ref:preceding-in-document-order-of(ref:node-structural-information($x/b[4]/c[1]), ref:node-structural-information($x/b[1])),
+    ref:preceding-in-document-order-of(ref:node-structural-information($x/b[4]/c[1]), ref:node-structural-information($x/b[4])),
+    ref:preceding-in-document-order-of(ref:node-structural-information($y), ref:node-structural-information($x)),
+    ref:preceding-in-document-order-of(ref:node-structural-information($x), ref:node-structural-information($y)),
+    ref:preceding-in-document-order-of(ref:node-structural-information($x), ref:node-structural-information($x)),
+    ref:preceding-in-document-order-of(ref:node-structural-information($x/b[1]), ref:node-structural-information($x/b[4]/@attr)),
+    ref:preceding-in-document-order-of(ref:node-structural-information($x/b[1]), ref:node-structural-information($x/b[4]/c[1])),
+    ref:preceding-in-document-order-of(ref:node-structural-information($x/b[4]), ref:node-structural-information($x/b[4]/c[1]))
+  }
+  </preceding-in-document-order-of>
+  <following-in-document-order-of>
+  { 
+    ref:following-in-document-order-of(ref:node-structural-information($x/b[1]), ref:node-structural-information($x/b[4]/@attr)),   
+    ref:following-in-document-order-of(ref:node-structural-information($x/b[1]), ref:node-structural-information($x/b[4]/c[1])),
+    ref:following-in-document-order-of(ref:node-structural-information($x/b[4]), ref:node-structural-information($x/b[4]/c[1])),
+    ref:following-in-document-order-of(ref:node-structural-information($x), ref:node-structural-information($y)),
+    ref:following-in-document-order-of(ref:node-structural-information($y), ref:node-structural-information($x)),
+    ref:following-in-document-order-of(ref:node-structural-information($x), ref:node-structural-information($x)),
+    ref:following-in-document-order-of(ref:node-structural-information($x/b[4]/@attr), ref:node-structural-information($x/b[1])),
+    ref:following-in-document-order-of(ref:node-structural-information($x/b[4]/c[1]), ref:node-structural-information($x/b[1])),
+    ref:following-in-document-order-of(ref:node-structural-information($x/b[4]/c[1]), ref:node-structural-information($x/b[4]))
+  }
+  </following-in-document-order-of>
+  <level>
+  {
+    ref:level(ref:node-structural-information($x)),
+    ref:level(ref:node-structural-information($x/b[1])),
+    ref:level(ref:node-structural-information($x/newb[1])),
+    ref:level(ref:node-structural-information($x/newb[2])),
+    ref:level(ref:node-structural-information($x/b/@attr)),
+    ref:level(ref:node-structural-information($x/b/c[1]))
+  }
+  </level>
+  <sibling-of>
+  {
+    ref:sibling-of(ref:node-structural-information($x/b[1]), ref:node-structural-information($x/b[2])),
+    ref:sibling-of(ref:node-structural-information($x/b[1]), ref:node-structural-information($x/newb[1])),
+    ref:sibling-of(ref:node-structural-information($x/b[2]), ref:node-structural-information($x/b[1])),
+    ref:sibling-of(ref:node-structural-information($x), ref:node-structural-information($x)),
+    ref:sibling-of(ref:node-structural-information($x/b/@attr), ref:node-structural-information($x/b/@attr2)),
+    ref:sibling-of(ref:node-structural-information($x/b/@attr2), ref:node-structural-information($x/b/@attr)),
+    ref:sibling-of(ref:node-structural-information($x/b[1]), ref:node-structural-information($y/b[2]))
+  }  
+  </sibling-of>
+  <in-same-tree-of>
+  {
+    ref:in-same-tree-of(ref:node-structural-information($x/b[1]), ref:node-structural-information($x/b[2])),
+    ref:in-same-tree-of(ref:node-structural-information($y/b[1]), ref:node-structural-information($y/b[2])),
+    ref:in-same-tree-of(ref:node-structural-information($x/b[1]), ref:node-structural-information($y/b[2])),
+    ref:in-same-tree-of(ref:node-structural-information($y/b[2]), ref:node-structural-information($x/b[1]))    
+  }
+  </in-same-tree-of>
+  <in-collection>
+  {
+    ref:in-collection(ref:node-structural-information($xx/b)),
+    ref:in-collection(ref:node-structural-information($xx/b2)),
+    ref:in-collection(ref:node-structural-information($xx/b/bb)),
+    ref:in-collection(ref:node-structural-information($xx/b2/bb2)),
+    ref:in-collection(ref:node-structural-information($x)),
+    ref:in-collection(ref:node-structural-information($x/b[1])),
+    ref:in-collection(ref:node-structural-information($x/b/@attr)),
+    ref:in-collection(ref:node-structural-information($x/b/c[1]))
+  }
+  </in-collection>
+  <in-same-collection>
+  {
+    ref:in-same-collection-of(ref:node-structural-information($xx/b),ref:node-structural-information($xx/b)),
+    ref:in-same-collection-of(ref:node-structural-information($xx/b2),ref:node-structural-information($xx/b2)),
+    ref:in-same-collection-of(ref:node-structural-information($xx/b/bb),ref:node-structural-information($xx/b/bb)),
+    ref:in-same-collection-of(ref:node-structural-information($xx/b2/bb2),ref:node-structural-information($xx/b2/bb2)),
+    ref:in-same-collection-of(ref:node-structural-information($xx/b),ref:node-structural-information($yy/b)),
+    ref:in-same-collection-of(ref:node-structural-information($xx/b2),ref:node-structural-information($yy/b2)),
+    ref:in-same-collection-of(ref:node-structural-information($xx/b/bb),ref:node-structural-information($yy/b/bb)),
+    ref:in-same-collection-of(ref:node-structural-information($xx/b2/bb2),ref:node-structural-information($yy/b2/bb2)),    
+    ref:in-same-collection-of(ref:node-structural-information($x),ref:node-structural-information($x))    
+  }
+  </in-same-collection>
+</result>    
+ 
\ No newline at end of file

=== added file 'test/rbkt/Queries/zorba/nodes/structural_2_parsed.xq'
--- test/rbkt/Queries/zorba/nodes/structural_2_parsed.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/nodes/structural_2_parsed.xq	2011-10-06 09:58:24 +0000
@@ -0,0 +1,141 @@
+import module namespace ref = "http://www.zorba-xquery.com/modules/node-structural-information";;
+import module namespace ddl = "http://www.zorba-xquery.com/modules/store/dynamic/collections/ddl";;
+import module namespace dml = "http://www.zorba-xquery.com/modules/store/dynamic/collections/dml";;
+
+ddl:create(xs:QName("ddl:coll"),<dummy/>);
+variable $xx:=dml:collection(xs:QName("ddl:coll"));
+
+ddl:create(xs:QName("ddl:coll2"),<dummy/>);
+variable $yy:=dml:collection(xs:QName("ddl:coll2"));
+
+insert node <b/> into $xx;
+insert node <bb/> into $xx/b;
+insert node <b2/> into $xx;
+insert node <bb2/> into $xx/b2;
+
+insert node <b/> into $yy;
+insert node <bb/> into $yy/b;
+insert node <b2/> into $yy;
+insert node <bb2/> into $yy/b2;
+
+variable $x :=  doc("structural.xml")/a;
+insert node <newb><c/></newb> before $x/b[4];
+insert node <newb><c/></newb> after $x/b[4];
+variable $y :=  element {"x"}{$x}/*;
+
+<result>
+  <child-of>
+  {
+    ref:child-of(xs:anyURI(string(ref:node-structural-information($x))), xs:anyURI(string(ref:node-structural-information($x/b[1])))),
+    ref:child-of(xs:anyURI(string(ref:node-structural-information($x))), xs:anyURI(string(ref:node-structural-information($x/newb[1])))),
+    ref:child-of(xs:anyURI(string(ref:node-structural-information($x))), xs:anyURI(string(ref:node-structural-information($x/b[4]/c[1])))),
+    ref:child-of(xs:anyURI(string(ref:node-structural-information($x/b[1]))), xs:anyURI(string(ref:node-structural-information($x)))),
+    ref:child-of(xs:anyURI(string(ref:node-structural-information($x/b[4]/c[1]))), xs:anyURI(string(ref:node-structural-information($x)))),    
+    ref:child-of(xs:anyURI(string(ref:node-structural-information($x))), xs:anyURI(string(ref:node-structural-information($x)))),
+    ref:child-of(xs:anyURI(string(ref:node-structural-information($x/b[1]))), xs:anyURI(string(ref:node-structural-information($y))))
+  }
+  </child-of>
+  <attribute-of>
+  {
+    ref:attribute-of(xs:anyURI(string(ref:node-structural-information($x/b[4]))), xs:anyURI(string(ref:node-structural-information($x/b[4]/@attr)))),
+    ref:attribute-of(xs:anyURI(string(ref:node-structural-information($x/b[4]))), xs:anyURI(string(ref:node-structural-information($x/b[4]/c/@attr)))),
+    ref:attribute-of(xs:anyURI(string(ref:node-structural-information($x/b[4]/@attr))), xs:anyURI(string(ref:node-structural-information($x/b[4])))),
+    ref:attribute-of(xs:anyURI(string(ref:node-structural-information($x/b[4]/c/@attr))), xs:anyURI(string(ref:node-structural-information($x/b[4])))),    
+    ref:attribute-of(xs:anyURI(string(ref:node-structural-information($x))), xs:anyURI(string(ref:node-structural-information($x/b[1])))),
+    ref:attribute-of(xs:anyURI(string(ref:node-structural-information($x))), xs:anyURI(string(ref:node-structural-information($x/newb[1])))),    
+    ref:attribute-of(xs:anyURI(string(ref:node-structural-information($x/b[4]/@attr))), xs:anyURI(string(ref:node-structural-information($x/b[4]/@attr)))),
+    ref:attribute-of(xs:anyURI(string(ref:node-structural-information($x/b[4]))), xs:anyURI(string(ref:node-structural-information($y/b[4]/@attr))))
+  }
+  </attribute-of>
+  <parent-of>
+  { 
+    ref:parent-of(xs:anyURI(string(ref:node-structural-information($x/b[1]))), xs:anyURI(string(ref:node-structural-information($x)))),
+    ref:parent-of(xs:anyURI(string(ref:node-structural-information($x/newb[1]))), xs:anyURI(string(ref:node-structural-information($x)))),
+    ref:parent-of(xs:anyURI(string(ref:node-structural-information($x/b[4]/c[1]))), xs:anyURI(string(ref:node-structural-information($x)))),
+    ref:parent-of(xs:anyURI(string(ref:node-structural-information($x))), xs:anyURI(string(ref:node-structural-information($x/b[1])))),
+    ref:parent-of(xs:anyURI(string(ref:node-structural-information($x))), xs:anyURI(string(ref:node-structural-information($x/b[4]/c[1])))),        
+    ref:parent-of(xs:anyURI(string(ref:node-structural-information($x))), xs:anyURI(string(ref:node-structural-information($x)))),
+    ref:parent-of(xs:anyURI(string(ref:node-structural-information($x/b[1]))), xs:anyURI(string(ref:node-structural-information($y))))
+  }
+  </parent-of>
+  <preceding-in-document-order-of>
+  {
+    ref:preceding-in-document-order-of(xs:anyURI(string(ref:node-structural-information($x/b[4]/@attr))), xs:anyURI(string(ref:node-structural-information($x/b[1])))),
+    ref:preceding-in-document-order-of(xs:anyURI(string(ref:node-structural-information($x/b[4]/c[1]))), xs:anyURI(string(ref:node-structural-information($x/b[1])))),
+    ref:preceding-in-document-order-of(xs:anyURI(string(ref:node-structural-information($x/b[4]/c[1]))), xs:anyURI(string(ref:node-structural-information($x/b[4])))),
+    ref:preceding-in-document-order-of(xs:anyURI(string(ref:node-structural-information($y))), xs:anyURI(string(ref:node-structural-information($x)))),
+    ref:preceding-in-document-order-of(xs:anyURI(string(ref:node-structural-information($x))), xs:anyURI(string(ref:node-structural-information($y)))),
+    ref:preceding-in-document-order-of(xs:anyURI(string(ref:node-structural-information($x))), xs:anyURI(string(ref:node-structural-information($x)))),
+    ref:preceding-in-document-order-of(xs:anyURI(string(ref:node-structural-information($x/b[1]))), xs:anyURI(string(ref:node-structural-information($x/b[4]/@attr)))),
+    ref:preceding-in-document-order-of(xs:anyURI(string(ref:node-structural-information($x/b[1]))), xs:anyURI(string(ref:node-structural-information($x/b[4]/c[1])))),
+    ref:preceding-in-document-order-of(xs:anyURI(string(ref:node-structural-information($x/b[4]))), xs:anyURI(string(ref:node-structural-information($x/b[4]/c[1]))))
+  }
+  </preceding-in-document-order-of>
+  <following-in-document-order-of>
+  {
+    ref:following-in-document-order-of(xs:anyURI(string(ref:node-structural-information($x/b[1]))), xs:anyURI(string(ref:node-structural-information($x/b[4]/@attr)))),
+    ref:following-in-document-order-of(xs:anyURI(string(ref:node-structural-information($x/b[1]))), xs:anyURI(string(ref:node-structural-information($x/b[4]/c[1])))),
+    ref:following-in-document-order-of(xs:anyURI(string(ref:node-structural-information($x/b[4]))), xs:anyURI(string(ref:node-structural-information($x/b[4]/c[1])))),
+    ref:following-in-document-order-of(xs:anyURI(string(ref:node-structural-information($x))), xs:anyURI(string(ref:node-structural-information($y)))),
+    ref:following-in-document-order-of(xs:anyURI(string(ref:node-structural-information($y))), xs:anyURI(string(ref:node-structural-information($x)))),
+    ref:following-in-document-order-of(xs:anyURI(string(ref:node-structural-information($x))), xs:anyURI(string(ref:node-structural-information($x)))),
+    ref:following-in-document-order-of(xs:anyURI(string(ref:node-structural-information($x/b[4]/@attr))), xs:anyURI(string(ref:node-structural-information($x/b[1])))),
+    ref:following-in-document-order-of(xs:anyURI(string(ref:node-structural-information($x/b[4]/c[1]))), xs:anyURI(string(ref:node-structural-information($x/b[1])))),    
+    ref:following-in-document-order-of(xs:anyURI(string(ref:node-structural-information($x/b[4]/c[1]))), xs:anyURI(string(ref:node-structural-information($x/b[4]))))
+  }
+  </following-in-document-order-of>
+  <level>
+  {
+    ref:level(xs:anyURI(string(ref:node-structural-information($x)))),
+    ref:level(xs:anyURI(string(ref:node-structural-information($x/b[1])))),
+    ref:level(xs:anyURI(string(ref:node-structural-information($x/newb[1])))),
+    ref:level(xs:anyURI(string(ref:node-structural-information($x/newb[2])))),
+    ref:level(xs:anyURI(string(ref:node-structural-information($x/b/@attr)))),
+    ref:level(xs:anyURI(string(ref:node-structural-information($x/b/c[1]))))
+  }
+  </level>
+  <sibling-of>
+  {
+    ref:sibling-of(xs:anyURI(string(ref:node-structural-information($x/b[1]))), xs:anyURI(string(ref:node-structural-information($x/b[2])))),
+    ref:sibling-of(xs:anyURI(string(ref:node-structural-information($x/b[1]))), xs:anyURI(string(ref:node-structural-information($x/newb[1])))),
+    ref:sibling-of(xs:anyURI(string(ref:node-structural-information($x/b[2]))), xs:anyURI(string(ref:node-structural-information($x/b[1])))),
+    ref:sibling-of(xs:anyURI(string(ref:node-structural-information($x))), xs:anyURI(string(ref:node-structural-information($x)))),
+    ref:sibling-of(xs:anyURI(string(ref:node-structural-information($x/b/@attr))), xs:anyURI(string(ref:node-structural-information($x/b/@attr2)))),
+    ref:sibling-of(xs:anyURI(string(ref:node-structural-information($x/b/@attr2))), xs:anyURI(string(ref:node-structural-information($x/b/@attr)))),
+    ref:sibling-of(xs:anyURI(string(ref:node-structural-information($x/b[1]))), xs:anyURI(string(ref:node-structural-information($y/b[2]))))
+  }  
+  </sibling-of>
+  <in-same-tree-of>
+  {
+    ref:in-same-tree-of(xs:anyURI(string(ref:node-structural-information($x/b[1]))), xs:anyURI(string(ref:node-structural-information($x/b[2])))),
+    ref:in-same-tree-of(xs:anyURI(string(ref:node-structural-information($y/b[1]))), xs:anyURI(string(ref:node-structural-information($y/b[2])))),
+    ref:in-same-tree-of(xs:anyURI(string(ref:node-structural-information($x/b[1]))), xs:anyURI(string(ref:node-structural-information($y/b[2])))),
+    ref:in-same-tree-of(xs:anyURI(string(ref:node-structural-information($y/b[2]))), xs:anyURI(string(ref:node-structural-information($x/b[1]))))    
+  }
+  </in-same-tree-of>
+  <in-collection>
+  {
+    ref:in-collection(xs:anyURI(string(ref:node-structural-information($xx/b)))),
+    ref:in-collection(xs:anyURI(string(ref:node-structural-information($xx/b2)))),
+    ref:in-collection(xs:anyURI(string(ref:node-structural-information($xx/b/bb)))),
+    ref:in-collection(xs:anyURI(string(ref:node-structural-information($xx/b2/bb2)))),
+    ref:in-collection(xs:anyURI(string(ref:node-structural-information($x)))),
+    ref:in-collection(xs:anyURI(string(ref:node-structural-information($x/b[1])))),
+    ref:in-collection(xs:anyURI(string(ref:node-structural-information($x/b/@attr)))),
+    ref:in-collection(xs:anyURI(string(ref:node-structural-information($x/b/c[1]))))
+  }
+  </in-collection>
+  <in-same-collection>
+  {
+    ref:in-same-collection-of(xs:anyURI(string(ref:node-structural-information($xx/b))),xs:anyURI(string(ref:node-structural-information($xx/b)))),
+    ref:in-same-collection-of(xs:anyURI(string(ref:node-structural-information($xx/b2))),xs:anyURI(string(ref:node-structural-information($xx/b2)))),
+    ref:in-same-collection-of(xs:anyURI(string(ref:node-structural-information($xx/b/bb))),xs:anyURI(string(ref:node-structural-information($xx/b/bb)))),
+    ref:in-same-collection-of(xs:anyURI(string(ref:node-structural-information($xx/b2/bb2))),xs:anyURI(string(ref:node-structural-information($xx/b2/bb2)))),
+    ref:in-same-collection-of(xs:anyURI(string(ref:node-structural-information($xx/b))),xs:anyURI(string(ref:node-structural-information($yy/b)))),
+    ref:in-same-collection-of(xs:anyURI(string(ref:node-structural-information($xx/b2))),xs:anyURI(string(ref:node-structural-information($yy/b2)))),
+    ref:in-same-collection-of(xs:anyURI(string(ref:node-structural-information($xx/b/bb))),xs:anyURI(string(ref:node-structural-information($yy/b/bb)))),
+    ref:in-same-collection-of(xs:anyURI(string(ref:node-structural-information($xx/b2/bb2))),xs:anyURI(string(ref:node-structural-information($yy/b2/bb2)))),    
+    ref:in-same-collection-of(xs:anyURI(string(ref:node-structural-information($x))),xs:anyURI(string(ref:node-structural-information($x))))    
+  }
+  </in-same-collection>
+</result>
\ No newline at end of file

=== added file 'test/rbkt/Queries/zorba/nodes/structural_3.xq'
--- test/rbkt/Queries/zorba/nodes/structural_3.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/nodes/structural_3.xq	2011-10-06 09:58:24 +0000
@@ -0,0 +1,32 @@
+import module namespace ref = "http://www.zorba-xquery.com/modules/node-structural-information";;
+
+declare function local:test-types($s-info)
+{
+(
+  ref:is-attribute($s-info),
+  ref:is-comment($s-info),
+  ref:is-document($s-info),
+  ref:is-element($s-info),
+  ref:is-processing-instruction($s-info),
+  ref:is-text($s-info)
+)  
+};
+
+variable $doc:=
+document 
+{
+  text{"text"},
+  comment{"comment"},
+  processing-instruction {"processing-instruction"}{"processing-instruction"},
+  element {"element"}{attribute {"attribute"}{"attribute"}}
+};
+
+
+<result>
+  <attr>{local:test-types(ref:node-structural-information($doc//attribute()))}</attr>
+  <comm>{local:test-types(ref:node-structural-information($doc/comment()))}</comm>
+  <docu>{local:test-types(ref:node-structural-information($doc))}</docu>
+  <elem>{local:test-types(ref:node-structural-information($doc/element()))}</elem>
+  <proc>{local:test-types(ref:node-structural-information($doc/processing-instruction()))}</proc>
+  <text>{local:test-types(ref:node-structural-information($doc/text()))}</text>
+</result>   

=== added file 'test/rbkt/Queries/zorba/nodes/structural_3_parsed.xq'
--- test/rbkt/Queries/zorba/nodes/structural_3_parsed.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/nodes/structural_3_parsed.xq	2011-10-06 09:58:24 +0000
@@ -0,0 +1,34 @@
+import module namespace ref = "http://www.zorba-xquery.com/modules/node-structural-information";;
+
+declare function local:test-types($s-info)
+{
+  let $s-info2:=xs:anyURI(string($s-info))
+  return
+(
+  ref:is-attribute($s-info2),
+  ref:is-comment($s-info2),
+  ref:is-document($s-info2),
+  ref:is-element($s-info2),
+  ref:is-processing-instruction($s-info2),
+  ref:is-text($s-info2)
+)  
+};
+
+variable $doc:=
+document 
+{
+  text{"text"},
+  comment{"comment"},
+  processing-instruction {"processing-instruction"}{"processing-instruction"},
+  element {"element"}{attribute {"attribute"}{"attribute"}}
+};
+
+
+<result>
+  <attr>{local:test-types(ref:node-structural-information($doc//attribute()))}</attr>
+  <comm>{local:test-types(ref:node-structural-information($doc/comment()))}</comm>
+  <docu>{local:test-types(ref:node-structural-information($doc))}</docu>
+  <elem>{local:test-types(ref:node-structural-information($doc/element()))}</elem>
+  <proc>{local:test-types(ref:node-structural-information($doc/processing-instruction()))}</proc>
+  <text>{local:test-types(ref:node-structural-information($doc/text()))}</text>
+</result>   

=== added file 'test/rbkt/Queries/zorba/nodes/structural_4.xq'
--- test/rbkt/Queries/zorba/nodes/structural_4.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/nodes/structural_4.xq	2011-10-06 09:58:24 +0000
@@ -0,0 +1,84 @@
+import module namespace ref = "http://www.zorba-xquery.com/modules/node-structural-information";;
+
+declare function local:get-ordpath($struct)
+{
+replace($struct,'^zorba:\d*\.\d*\.\d*\.','ref:')
+};
+
+declare function local:test-generated-ordpath($testa,$testb)
+{
+  let $orda:=local:get-ordpath(ref:node-structural-information($testa))
+  let $ordb:=local:get-ordpath(ref:node-structural-information($testb))
+  return
+    if ($orda eq $ordb)
+    then concat("OK: ",$orda)    
+    else concat("KO: ",$orda," != ",$ordb)    
+};
+
+variable $test1a:=text{"aaa"};
+variable $test1b:=<aaa/>;
+
+variable $test2a:=<element>aaa</element>;
+variable $test2b:=<element><aaa/></element>;
+
+variable $test3a:=<element><x/>aaa</element>;
+variable $test3b:=<element><x/><aaa/></element>;
+
+variable $test4a:=<element attr="attr">aaa</element>;
+variable $test4b:=<element attr="attr"><aaa/></element>;
+
+variable $test5a:=<element attr="attr"><x/>aaa</element>;
+variable $test5b:=<element attr="attr"><x/><aaa/></element>;
+
+variable $test6a:=<element>aaa</element>;
+variable $test6b:=<element><aaa/></element>;
+
+variable $test7a:=<element><x/>aaa</element>;
+variable $test7b:=<element><x/><aaa/></element>;
+
+variable $test8a:=<element attr="attr">aaa</element>;
+variable $test8b:=<element attr="attr"><aaa/></element>;
+
+variable $test9a:=<element attr="attr"><x/>aaa</element>;
+variable $test9b:=<element attr="attr"><x/><aaa/></element>;
+
+variable $test10a:=<element><bbb/></element>;
+insert node text{"aaa"} as first into $test10a;
+variable $test10b:=<element><bbb/></element>;
+insert node <aaa/> as first into $test10b;
+
+variable $test11a:=<element><x/><bbb/></element>;
+insert node text{"aaa"} after $test11a/x;
+variable $test11b:=<element><x/><bbb/></element>;
+insert node <aaa/> after $test11b/x;
+
+variable $test12a:=<element attr="attr"><bbb/></element>;
+insert node text{"aaa"} as first into $test12a;
+variable $test12b:=<element attr="attr"><bbb/></element>;
+insert node <aaa/> as first into $test12b;
+
+variable $test13a:=<element attr="attr"><x/><bbb/></element>;
+insert node text{"aaa"} after $test13a/x;
+variable $test13b:=<element attr="attr"><x/><bbb/></element>;
+insert node <aaa/> after $test13b/x;
+
+<result>
+  <test1>{local:test-generated-ordpath($test1a,$test1b)}</test1>
+  <test2>{local:test-generated-ordpath($test2a/text(),$test2b/aaa)}</test2>
+  <test3>{local:test-generated-ordpath($test3a/text(),$test3b/aaa)}</test3>
+  <test4>{local:test-generated-ordpath($test4a/text(),$test4b/aaa)}</test4>
+  <test5>{local:test-generated-ordpath($test5a/text(),$test5b/aaa)}</test5>
+  <test6>{local:test-generated-ordpath($test6a/text(),$test6b/aaa)}</test6>
+  <test7>{local:test-generated-ordpath($test7a/text(),$test7b/aaa)}</test7>
+  <test8>{local:test-generated-ordpath($test8a/text(),$test8b/aaa)}</test8>
+  <test9>{local:test-generated-ordpath($test9a/text(),$test9b/aaa)}</test9>
+  <test10>{local:test-generated-ordpath($test10a/text(),$test10b/aaa)}</test10>
+  <test11>{local:test-generated-ordpath($test11a/text(),$test11b/aaa)}</test11>
+  <test12>{local:test-generated-ordpath($test12a/text(),$test12b/aaa)}</test12>
+  <test13>{local:test-generated-ordpath($test13a/text(),$test13b/aaa)}</test13>
+</result>
+
+
+
+
+

=== added file 'test/rbkt/Queries/zorba/nodes/structural_4_parsed.xq'
--- test/rbkt/Queries/zorba/nodes/structural_4_parsed.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/nodes/structural_4_parsed.xq	2011-10-06 09:58:24 +0000
@@ -0,0 +1,81 @@
+import module namespace ref = "http://www.zorba-xquery.com/modules/node-structural-information";;
+
+declare function local:get-ordpath($struct)
+{
+replace($struct,'^zorba:\d*\.\d*\.\d*\.','ref:')
+};
+
+declare function local:test-generated-ordpath($testa,$testb)
+{
+  let $orda:=local:get-ordpath(xs:anyURI(string(ref:node-structural-information($testa))))
+  let $ordb:=local:get-ordpath(xs:anyURI(string(ref:node-structural-information($testb))))
+  return
+    if ($orda eq $ordb)
+    then concat("OK: ",$orda)    
+    else concat("KO: ",$orda," != ",$ordb)    
+};
+
+variable $test1a:=text{"aaa"};
+variable $test1b:=<aaa/>;
+
+variable $test2a:=<element>aaa</element>;
+variable $test2b:=<element><aaa/></element>;
+
+variable $test3a:=<element><x/>aaa</element>;
+variable $test3b:=<element><x/><aaa/></element>;
+
+variable $test4a:=<element attr="attr">aaa</element>;
+variable $test4b:=<element attr="attr"><aaa/></element>;
+
+variable $test5a:=<element attr="attr"><x/>aaa</element>;
+variable $test5b:=<element attr="attr"><x/><aaa/></element>;
+
+variable $test6a:=<element>aaa<bbb/></element>;
+variable $test6b:=<element><aaa/><bbb/></element>;
+
+variable $test7a:=<element><x/>aaa<bbb/></element>;
+variable $test7b:=<element><x/><aaa/><bbb/></element>;
+
+variable $test8a:=<element attr="attr">aaa<bbb/></element>;
+variable $test8b:=<element attr="attr"><aaa/><bbb/></element>;
+
+variable $test9a:=<element attr="attr"><x/>aaa<bbb/></element>;
+variable $test9b:=<element attr="attr"><x/><aaa/><bbb/></element>;
+
+variable $test10a:=<element><bbb/></element>;
+insert node text{"aaa"} as first into $test10a;
+variable $test10b:=<element><bbb/></element>;
+insert node <aaa/> as first into $test10b;
+
+variable $test11a:=<element><x/><bbb/></element>;
+insert node text{"aaa"} after $test11a/x;
+variable $test11b:=<element><x/><bbb/></element>;
+insert node <aaa/> after $test11b/x;
+
+variable $test12a:=<element attr="attr"><bbb/></element>;
+insert node text{"aaa"} as first into $test12a;
+variable $test12b:=<element attr="attr"><bbb/></element>;
+insert node <aaa/> as first into $test12b;
+
+variable $test13a:=<element attr="attr"><x/><bbb/></element>;
+insert node text{"aaa"} after $test13a/x;
+variable $test13b:=<element attr="attr"><x/><bbb/></element>;
+insert node <aaa/> after $test13b/x;
+
+<result>
+  <test1>{local:test-generated-ordpath($test1a,$test1b)}</test1>
+  <test2>{local:test-generated-ordpath($test2a/text(),$test2b/aaa)}</test2>
+  <test3>{local:test-generated-ordpath($test3a/text(),$test3b/aaa)}</test3>
+  <test4>{local:test-generated-ordpath($test4a/text(),$test4b/aaa)}</test4>
+  <test5>{local:test-generated-ordpath($test5a/text(),$test5b/aaa)}</test5>
+  <test6>{local:test-generated-ordpath($test6a/text(),$test6b/aaa)}</test6>
+  <test7>{local:test-generated-ordpath($test7a/text(),$test7b/aaa)}</test7>
+  <test8>{local:test-generated-ordpath($test8a/text(),$test8b/aaa)}</test8>
+  <test9>{local:test-generated-ordpath($test9a/text(),$test9b/aaa)}</test9>
+  <test10>{local:test-generated-ordpath($test10a/text(),$test10b/aaa)}</test10>
+  <test11>{local:test-generated-ordpath($test11a/text(),$test11b/aaa)}</test11>
+  <test12>{local:test-generated-ordpath($test12a/text(),$test12b/aaa)}</test12>
+  <test13>{local:test-generated-ordpath($test13a/text(),$test13b/aaa)}</test13>
+</result>
+
+


Follow ups