Index: /XSLTs/AAI/build.xml
===================================================================
--- /XSLTs/AAI/build.xml	(revision 5309)
+++ /XSLTs/AAI/build.xml	(revision 5309)
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
+    basedir="."
+    name="CLARIN ERIC AAI">
+
+    <property
+        name="XmlSecTool_directory_path"
+        value="/dev/null"/>
+    <property
+        name="schema_directory_path"
+        value="/dev/null"/>
+    <property
+        name="all_SPs_SAML_metadata_file_path"
+        value="/dev/null"/>
+    <property
+        name="SPF_SPs_SAML_metadata_file_path"
+        value="SPF_SPs_SAML_metadata.xml"/>
+    <property
+        name="XML_catalog_file_path"
+        value="XML_catalog.xml"/>
+    <property
+        name="Java_max_memory"
+        value="768m"/>
+    
+    <!-- The following XMLSECTOOL task is based on:
+         <import>
+          <url url="https://raw.githubusercontent.com/ukf/ukf-meta/master/build.xml"/>
+         </import> 
+    -->
+    <macrodef
+        name="XMLSECTOOL">
+        <attribute
+            name="input-file-path"/>
+        <element
+            name="args"
+            optional="yes"/>
+        <sequential>
+            <java
+                classname="edu.internet2.middleware.security.XmlSecTool"
+                failonerror="true"
+                fork="true"
+                maxmemory="${Java_max_memory}">
+                <classpath>
+                    <fileset
+                        dir="${XmlSecTool_directory_path}/lib/">
+                        <include
+                            name="*.jar"/>
+                    </fileset>
+                </classpath>
+                <jvmarg
+                    value="-Djava.endorsed.dirs=${xmlsectool_directory_path}/lib/endorsed/"/>
+                <jvmarg
+                    value="-Dedu.internet2.middleware.security.XmlSecTool.home=${XmlSecTool_directory_path}"/>
+                <args/>
+                <arg
+                    value="--validateSchema"/>
+                <arg
+                    value="--xsd"/>
+                <arg
+                    value="--schemaDirectory"/>
+                <arg
+                    value="${schema_directory_path}"/>
+                <arg
+                    value="--inFile"/>
+                <arg
+                    value="@{input-file-path}"/>
+            </java>
+        </sequential>
+    </macrodef>
+
+    <target
+        name="SAML_XSDs_XML_catalog">
+        <xslt
+            destdir="."
+            in="../extract_XSD_namespaces.xsl"
+            out="${XML_catalog_file_path}"
+            style="../extract_XSD_namespaces.xsl">
+            <factory
+                name="net.sf.saxon.TransformerFactoryImpl"/>
+            <param
+                expression="${schema_directory_path}"
+                name="schema_directory_path"/>
+        </xslt>
+    </target>
+
+    <target
+        name="SPF_SPs_SAML_metadata">
+        <sequential>
+            <xslt
+                in="${all_SPs_SAML_metadata_file_path}"
+                out="${SPF_SPs_SAML_metadata_file_path}"
+                style="../SPF_SPs_SAML_metadata.xsl">
+                <factory
+                    name="net.sf.saxon.TransformerFactoryImpl"/>
+            </xslt>
+            <XMLSECTOOL
+                input-file-path="${SPF_SPs_SAML_metadata_file_path}"/>
+        </sequential>
+    </target>
+    
+    <target
+        name="validate_SAML_metadata">
+        <XMLSECTOOL
+            input-file-path="${all_SPs_SAML_metadata_file_path}"/>
+    </target>
+</project>
Index: /XSLTs/SPF_SPs_SAML_metadata.xsl
===================================================================
--- /XSLTs/SPF_SPs_SAML_metadata.xsl	(revision 5309)
+++ /XSLTs/SPF_SPs_SAML_metadata.xsl	(revision 5309)
@@ -0,0 +1,69 @@
+<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata">
+    <xsl:output omit-xml-declaration="no" indent="yes"/>
+    <!-- Saxon EE only: 
+    <xsl:import-schema 
+        namespace="urn:oasis:names:tc:SAML:2.0:metadata"
+        schema-location="saml-schema-metadata-2.0.xsd"/>
+    <xsl:import-schema 
+        namespace="urn:oasis:names:tc:SAML:metadata:ui"
+        schema-location="sstc-saml-metadata-ui-v1.0.xsd"/>
+    <xsl:import-schema 
+        namespace="urn:mace:shibboleth:metadata:1.0"
+        schema-location="shibboleth-metadata-1.0.xsd"/>
+    <xsl:import-schema 
+        namespace="http://www.w3.org/2000/09/xmldsig#"
+        schema-location="xmldsig-core-schema.xsd"/>
+    -->
+
+    <xsl:param name="official_SPF_SPs"
+        select="(
+        'https://shibboleth.bbaw.de/shibboleth',
+        'http://sp.lat.csc.fi', 
+        'https://shibboleth.bbaw.de/shibboleth', 
+        'https://sp.korp.csc.fi/', 
+        'https://secure.huygens.knaw.nl', 
+        'https://clarin.ids-mannheim.de/shibboleth', 
+        'https://repos.ids-mannheim.de/shibboleth', 
+        'https://sp.lux17.mpi.nl', 
+        'https://sp.catalog.clarin.eu', 
+        'https://sp.corpus1.mpi.nl', 
+        'https://sp.dev.clarin.inl.nl/shibboleth', 
+        'https://portal.clarin.inl.nl/', 
+        'https://ufal-point.mff.cuni.cz/shibboleth/eduid/sp', 
+        'https://weblicht.sfs.uni-tuebingen.de', 
+        'https://infra.clarin.dk/shibboleth', 
+        'https://www.meertens.knaw.nl/Shibboleth.sso/Metadata' 
+        )"
+        as="xs:string+"/>
+
+    <xsl:template match="*|@*|text()|processing-instruction()" name="copy">
+        <xsl:copy>
+            <xsl:apply-templates select="*|@*|text()|processing-instruction()"/>
+        </xsl:copy>
+    </xsl:template>
+
+    <xsl:template match="comment()" name="delete"/>
+
+    <xsl:template name="SPF_SPs">
+        <xsl:if test="@entityID = $official_SPF_SPs">
+            <!-- <xsl:copy xsl:validation="strict"> Saxon EE only -->
+            <!-- <xsl:copy>-->
+            <xsl:call-template name="copy"/>
+            <!--</xsl:copy>-->
+        </xsl:if>
+    </xsl:template>
+
+    <!--
+    <xsl:template match="document-node()">
+        <xsl:message terminate="yes">Invalid document.</xsl:message>
+    </xsl:template> 
+    -->
+
+    <!--
+        <xsl:template match="document-node(schema-element('md:EntityDescriptor'))">
+    Saxon EE only -->
+    <xsl:template match="/md:EntitiesDescriptor/md:EntityDescriptor">
+        <xsl:call-template name="SPF_SPs"/>
+    </xsl:template>
+</xsl:stylesheet>
Index: /XSLTs/extract_XSD_namespaces.xsl
===================================================================
--- /XSLTs/extract_XSD_namespaces.xsl	(revision 5309)
+++ /XSLTs/extract_XSD_namespaces.xsl	(revision 5309)
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:catalog="urn:oasis:names:tc:entity:xmlns:xml:catalog"
+    exclude-result-prefixes="xsl xsd catalog" version="2.0">
+    <xsl:output method="xml" omit-xml-declaration="no" indent="yes"/>
+    <xsl:output doctype-public="-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
+        doctype-system="http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd"/>
+
+    <xsl:template match="*|@*|text()|processing-instruction()|comment()" name="delete"/>
+
+    <xsl:param name="schema_directory_URI"/>
+
+    <xsl:template match="/">
+        <xsl:element name="catalog" namespace="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+            <!--  Iterate over all XSD files under schema_directory_URI. -->
+            <xsl:for-each select="collection(concat($schema_directory_URI, '?select=*.xsd'))">
+                <xsl:message>
+                    <xsl:value-of select="document-uri(.)"/>
+                </xsl:message>
+                <xsl:for-each select="/xsd:schema">
+                    <xsl:call-template name="schema_element"/>
+                </xsl:for-each>
+            </xsl:for-each>
+        </xsl:element>
+    </xsl:template>
+
+    <xsl:template name="schema_element">
+        <xsl:if test="normalize-space(@targetNamespace) != ''">
+            <!-- Create an element in the catalog mapping from a namespace to the appropriate URI -->
+            <xsl:element name="uri" namespace="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+                <xsl:attribute name="name" select="@targetNamespace"/>
+                <xsl:attribute name="uri" select="base-uri()"/>
+            </xsl:element>
+            <xsl:message>
+                <xsl:value-of select="base-uri()"/> describes namespace '<xsl:value-of
+                    select="@targetNamespace"/>'. </xsl:message>
+        </xsl:if>
+    </xsl:template>
+</xsl:stylesheet>
