I have a main xsl file and I would like to include in it two xsl files. I tried using the include function of XSL but without success. I read some examples on the web but I always got the following error: element include only allowed as child of stylesheet Could you please tell me what I'm doing wrong? In the following the main.xsl file I'm using where I inserted the xsl:include already: main.xsl:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<xsl:include href="distributor.xsl"/>
<mdb:MD_Metadata xmlns:mri="http://standards.iso.org/iso/19115/-3/mri/1.0"
xmlns:mas="http://standards.iso.org/iso/19115/-3/mas/1.0"
xmlns:mrs="http://standards.iso.org/iso/19115/-3/mrs/1.0"
xmlns:mda="http://standards.iso.org/iso/19115/-3/mda/1.0"
xmlns:cit="http://standards.iso.org/iso/19115/-3/cit/2.0"
xmlns:mcc="http://standards.iso.org/iso/19115/-3/mcc/1.0"
xmlns:mdt="http://standards.iso.org/iso/19115/-3/mdt/2.0"
xmlns:msr="http://standards.iso.org/iso/19115/-3/msr/2.0"
xmlns:gex="http://standards.iso.org/iso/19115/-3/gex/1.0"
xmlns:lan="http://standards.iso.org/iso/19115/-3/lan/1.0"
xmlns:gcx="http://standards.iso.org/iso/19115/-3/gcx/1.0"
xmlns:mco="http://standards.iso.org/iso/19115/-3/mco/1.0"
xmlns:mds="http://standards.iso.org/iso/19115/-3/mds/2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:gfc="http://standards.iso.org/iso/19110/gfc/1.1"
xmlns:srv="http://standards.iso.org/iso/19115/-3/srv/2.1"
xmlns:mac="http://standards.iso.org/iso/19115/-3/mac/2.0"
xmlns:mdb="http://standards.iso.org/iso/19115/-3/mdb/2.0"
xmlns:mdq="http://standards.iso.org/iso/19157/-2/mdq/1.0"
xmlns:mex="http://standards.iso.org/iso/19115/-3/mex/1.0"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:mrl="http://standards.iso.org/iso/19115/-3/mrl/2.0"
xmlns:mmi="http://standards.iso.org/iso/19115/-3/mmi/1.0"
xmlns:gml="http://www.opengis.net/gml/3.2"
xmlns:mrc="http://standards.iso.org/iso/19115/-3/mrc/2.0"
xmlns:cat="http://standards.iso.org/iso/19115/-3/cat/1.0"
xmlns:mrd="http://standards.iso.org/iso/19115/-3/mrd/1.0"
xmlns:mpc="http://standards.iso.org/iso/19115/-3/mpc/1.0"
xmlns:gmd="http://www.isotc211.org/2005/gmd"
xmlns:gco="http://standards.iso.org/iso/19115/-3/gco/1.0"
xmlns:old="http://www.isotc211.org/2005/gco"
xmlns:old_gml="http://www.opengis.net/gml">
<!-- DEFINE global variable here -->
<xsl:variable name="geonetwork_server" select="'http://myserver'" />
<xsl:variable name="webgis_geoserver" select="'http://webgis/geoserver/'" />
<xsl:variable name="openeo_collections" select="'https://mycollections/'" />
<xsl:variable name="collection_thumb_folder" select="'https://thumb_collections/'" />
<!-- ************************** -->
<mdb:metadataIdentifier>
<mcc:MD_Identifier>
<mcc:code>
<gco:CharacterString>$UUID</gco:CharacterString>
</mcc:code>
<mcc:codeSpace>
<gco:CharacterString>urn:uuid</gco:CharacterString>
</mcc:codeSpace>
</mcc:MD_Identifier>
</mdb:metadataIdentifier>
<mdb:defaultLocale>
<lan:PT_Locale id="EN">
<lan:language>
<lan:LanguageCode codeList="http://www.loc.gov/standards/iso639-2/" codeListValue="eng"/>
</lan:language>
<lan:characterEncoding>
<lan:MD_CharacterSetCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_CharacterSetCode"
codeListValue="utf8"/>
</lan:characterEncoding>
</lan:PT_Locale>
</mdb:defaultLocale>
<mdb:metadataScope>
<mdb:MD_MetadataScope>
<mdb:resourceScope>
<mcc:MD_ScopeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_ScopeCode"
codeListValue="dataset"/>
</mdb:resourceScope>
</mdb:MD_MetadataScope>
</mdb:metadataScope>
<mdb:contact>
<cit:CI_Responsibility>
<cit:role>
<cit:CI_RoleCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#CI_RoleCode"
codeListValue="pointOfContact"/>
</cit:role>
<cit:party>
<cit:CI_Organisation>
<cit:name>
<gco:CharacterString>Institute </gco:CharacterString>
</cit:name>
<cit:contactInfo>
<cit:CI_Contact>
<cit:address>
<cit:CI_Address>
<cit:deliveryPoint>
<gco:CharacterString>address</gco:CharacterString>
</cit:deliveryPoint>
<cit:city>
<gco:CharacterString>city</gco:CharacterString>
</cit:city>
<cit:administrativeArea>
<gco:CharacterString>area</gco:CharacterString>
</cit:administrativeArea>
<cit:postalCode>
<gco:CharacterString>CAP</gco:CharacterString>
</cit:postalCode>
<cit:country>
<gco:CharacterString>nation</gco:CharacterString>
</cit:country>
<cit:electronicMailAddress>
<gco:CharacterString>[email protected]</gco:CharacterString>
</cit:electronicMailAddress>
</cit:CI_Address>
</cit:address>
<cit:onlineResource>
<cit:CI_OnlineResource>
<cit:linkage>
<gco:CharacterString>http://my_website</gco:CharacterString>
</cit:linkage>
<cit:protocol>
<gco:CharacterString>WWW:LINK-1.0-http--link</gco:CharacterString>
</cit:protocol>
<cit:applicationProfile>
<gco:CharacterString>profile</gco:CharacterString>
</cit:applicationProfile>
<cit:name>
<gco:CharacterString>name</gco:CharacterString>
</cit:name>
<cit:function>
<cit:CI_OnLineFunctionCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#CI_OnLineFunctionCode"
codeListValue="information"/>
</cit:function>
</cit:CI_OnlineResource>
</cit:onlineResource>
</cit:CI_Contact>
</cit:contactInfo>
<cit:individual>
<cit:CI_Individual>
<cit:name>
<gco:CharacterString>Bruce Banner</gco:CharacterString>
</cit:name>
<cit:positionName>
<gco:CharacterString>Researcher</gco:CharacterString>
</cit:positionName>
</cit:CI_Individual>
</cit:individual>
</cit:CI_Organisation>
</cit:party>
</cit:CI_Responsibility>
</mdb:contact>
<mdb:dateInfo>
<cit:CI_Date>
<cit:date>
<gco:DateTime>$DATE_REVISION</gco:DateTime>
</cit:date>
<cit:dateType>
<cit:CI_DateTypeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#CI_DateTypeCode"
codeListValue="revision"/>
</cit:dateType>
</cit:CI_Date>
</mdb:dateInfo>
<mdb:dateInfo>
<cit:CI_Date>
<cit:date>
<gco:DateTime><xsl:value-of select="/STAC/metadata/creation_time" /></gco:DateTime>
</cit:date>
<cit:dateType>
<cit:CI_DateTypeCode codeList="https://standards.iso.org/iso/19115/resources/Codelists/cat/codelists.xml#CI_DateTypeCode"
codeListValue="creation">creation</cit:CI_DateTypeCode>
</cit:dateType>
</cit:CI_Date>
</mdb:dateInfo>
<mdb:metadataStandard>
<cit:CI_Citation>
<cit:title>
<gco:CharacterString>ISO 19115-3</gco:CharacterString>
</cit:title>
</cit:CI_Citation>
</mdb:metadataStandard>
<mdb:metadataLinkage>
<cit:CI_OnlineResource>
<cit:linkage>
<gco:CharacterString><xsl:value-of select="$geonetwork_server" />$UUID</gco:CharacterString>
</cit:linkage>
<cit:function>
<cit:CI_OnLineFunctionCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#CI_OnLineFunctionCode"
codeListValue="completeMetadata"/>
</cit:function>
</cit:CI_OnlineResource>
</mdb:metadataLinkage>
<mdb:spatialRepresentationInfo>
<msr:MD_GridSpatialRepresentation>
<msr:numberOfDimensions>
<gco:Integer>2</gco:Integer>
</msr:numberOfDimensions>
<msr:axisDimensionProperties>
<msr:MD_Dimension>
<msr:dimensionName>
<msr:MD_DimensionNameTypeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_DimensionNameTypeCode"
codeListValue="row"/>
</msr:dimensionName>
<msr:dimensionSize>
<gco:Integer><xsl:value-of select="/STAC/metadata/properties/dimensions/rows" /></gco:Integer>
</msr:dimensionSize>
<msr:resolution>
<gco:Distance uom="m"><xsl:value-of select="/STAC/metadata/properties/bands/band[@bandId=1]/gsd" /></gco:Distance>
</msr:resolution>
<msr:dimensionTitle gco:nilReason="missing">
<gco:CharacterString/>
</msr:dimensionTitle>
<msr:dimensionDescription>
<gco:CharacterString>dims description </gco:CharacterString>
</msr:dimensionDescription>
</msr:MD_Dimension>
</msr:axisDimensionProperties>
<msr:axisDimensionProperties>
<msr:MD_Dimension>
<msr:dimensionName>
<msr:MD_DimensionNameTypeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_DimensionNameTypeCode"
codeListValue="column"/>
</msr:dimensionName>
<msr:dimensionSize>
<gco:Integer><xsl:value-of select="/STAC/metadata/properties/dimensions/columns" /></gco:Integer>
</msr:dimensionSize>
<msr:resolution>
<gco:Length uom="m"><xsl:value-of select="/STAC/metadata/properties/bands/band[@bandId=1]/gsd" /></gco:Length>
</msr:resolution>
<msr:dimensionTitle gco:nilReason="missing">
<gco:CharacterString/>
</msr:dimensionTitle>
<msr:dimensionDescription>
<gco:CharacterString>dims description </gco:CharacterString>
</msr:dimensionDescription>
</msr:MD_Dimension>
</msr:axisDimensionProperties>
<msr:cellGeometry>
<msr:MD_CellGeometryCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_CellGeometryCode"
codeListValue="area"/>
</msr:cellGeometry>
<msr:transformationParameterAvailability>
<gco:Boolean>false</gco:Boolean>
</msr:transformationParameterAvailability>
</msr:MD_GridSpatialRepresentation>
</mdb:spatialRepresentationInfo>
<mdb:referenceSystemInfo>
<mrs:MD_ReferenceSystem>
<mrs:referenceSystemIdentifier>
<mcc:MD_Identifier>
<mcc:code>
<gco:CharacterString><xsl:value-of select="/STAC/metadata/extent/spatial/epsg" /></gco:CharacterString>
</mcc:code>
<mcc:codeSpace>
<gco:CharacterString>EPSG</gco:CharacterString>
</mcc:codeSpace>
<mcc:description>
<gco:CharacterString>WGS-84</gco:CharacterString>
</mcc:description>
</mcc:MD_Identifier>
</mrs:referenceSystemIdentifier>
<mrs:referenceSystemType>
<mrs:MD_ReferenceSystemTypeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_ReferenceSystemTypeCode"
codeListValue="projected"/>
</mrs:referenceSystemType>
</mrs:MD_ReferenceSystem>
</mdb:referenceSystemInfo>
<mdb:identificationInfo>
<mri:MD_DataIdentification>
<mri:citation>
<cit:CI_Citation>
<cit:title>
<gco:CharacterString><xsl:value-of select="/STAC/metadata/title" /></gco:CharacterString>
</cit:title>
<cit:alternateTitle>
<gco:CharacterString><xsl:value-of select="/STAC/metadata/id" /></gco:CharacterString>
</cit:alternateTitle>
<cit:date>
<cit:CI_Date>
<cit:date>
<gco:DateTime>
<xsl:value-of select="/STAC/metadata/creation_time" />
</gco:DateTime>
</cit:date>
<cit:dateType>
<cit:CI_DateTypeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#CI_DateTypeCode"
codeListValue="creation"/>
</cit:dateType>
</cit:CI_Date>
</cit:date>
<!-- TEST INCLUDE -->
<!-- <xsl:include href = "publication_date.xsl"/>-->
<!-- TEST INCLUDE -->
<cit:edition>
<gco:CharacterString>INSERT HERE THE CURRENT VERSION OF THE CITED RESOURCE</gco:CharacterString>
</cit:edition>
<cit:identifier>
<mcc:MD_Identifier>
<mcc:code>
<gco:CharacterString>publisher</gco:CharacterString>
</mcc:code>
<mcc:codeSpace>
<xsl:variable name="my_collection_id" select="/STAC/metadata/id"/>
<gco:CharacterString><xsl:value-of select="concat($openeo_collections,$my_collection_id)"/></gco:CharacterString>
</mcc:codeSpace>
</mcc:MD_Identifier>
</cit:identifier>
<cit:presentationForm>
<cit:CI_PresentationFormCode codeListValue="mapDigital"
codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#CI_PresentationFormCode"/>
</cit:presentationForm>
</cit:CI_Citation>
</mri:citation>
<mri:abstract>
<gco:CharacterString><xsl:value-of select="/STAC/metadata/description" /></gco:CharacterString>
</mri:abstract>
<mri:purpose>
<gco:CharacterString><xsl:value-of select="/STAC/metadata/citation" /></gco:CharacterString>
</mri:purpose>
<mri:status>
<mcc:MD_ProgressCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_ProgressCode"
codeListValue="onGoing"/>
</mri:status>
<mri:pointOfContact>
<cit:CI_Responsibility>
<cit:role>
<cit:CI_RoleCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#CI_RoleCode"
codeListValue="custodian"/>
</cit:role>
<cit:party>
<cit:CI_Organisation>
<cit:name>
<gco:CharacterString>Organisation</gco:CharacterString>
</cit:name>
<cit:contactInfo>
<cit:CI_Contact>
<cit:address>
<cit:CI_Address>
<cit:deliveryPoint>
<gco:CharacterString>address</gco:CharacterString>
</cit:deliveryPoint>
<cit:city>
<gco:CharacterString>city</gco:CharacterString>
</cit:city>
<cit:administrativeArea>
<gco:CharacterString>Area</gco:CharacterString>
</cit:administrativeArea>
<cit:postalCode>
<gco:CharacterString>Postal_code</gco:CharacterString>
</cit:postalCode>
<cit:country>
<gco:CharacterString>nation</gco:CharacterString>
</cit:country>
<cit:electronicMailAddress>
<gco:CharacterString>email</gco:CharacterString>
</cit:electronicMailAddress>
</cit:CI_Address>
</cit:address>
<cit:onlineResource>
<cit:CI_OnlineResource>
<cit:linkage>
<gco:CharacterString>http://www.my_web.it</gco:CharacterString>
</cit:linkage>
<cit:protocol>
<gco:CharacterString>WWW:LINK-1.0-http--link</gco:CharacterString>
</cit:protocol>
<cit:name>
<gco:CharacterString>eurac research</gco:CharacterString>
</cit:name>
<cit:function>
<cit:CI_OnLineFunctionCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#CI_OnLineFunctionCode"
codeListValue="information"/>
</cit:function>
</cit:CI_OnlineResource>
</cit:onlineResource>
</cit:CI_Contact>
</cit:contactInfo>
<cit:logo>
<mcc:MD_BrowseGraphic>
<mcc:fileName>
<gco:CharacterString>logo.jpg</gco:CharacterString>
</mcc:fileName>
<mcc:fileDescription>
<gco:CharacterString>Project logo</gco:CharacterString>
</mcc:fileDescription>
<mcc:fileType>
<gco:CharacterString>JPEG</gco:CharacterString>
</mcc:fileType>
</mcc:MD_BrowseGraphic>
</cit:logo>
<xsl:for-each select="/STAC/metadata/properties/responsibles/responsible">
<cit:individual>
<cit:CI_Individual>
<cit:name>
<gco:CharacterString> <xsl:value-of select="."/></gco:CharacterString>
</cit:name>
<cit:positionName>
<gco:CharacterString><xsl:value-of select="@value" /></gco:CharacterString>
</cit:positionName>
</cit:CI_Individual>
</cit:individual>
</xsl:for-each>
</cit:CI_Organisation>
</cit:party>
</cit:CI_Responsibility>
</mri:pointOfContact>
<mri:spatialRepresentationType>
<mcc:MD_SpatialRepresentationTypeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_SpatialRepresentationTypeCode"
codeListValue="grid"/>
</mri:spatialRepresentationType>
<!-- <mri:topicCategory>
<mri:MD_TopicCategoryCode>Land</mri:MD_TopicCategoryCode>
</mri:topicCategory>-->
</mri:MD_DataIdentification>
</mdb:identificationInfo>
<mdb:distributionInfo>
<mrd:MD_Distribution>
<mrd:distributionFormat>
<mrd:MD_Format>
<mrd:formatSpecificationCitation>
<cit:CI_Citation>
<cit:title>
<gco:CharacterString>WCS</gco:CharacterString>
</cit:title>
<cit:date gco:nilReason="unknown"/>
<cit:edition>
<gco:CharacterString>2.0</gco:CharacterString>
</cit:edition>
</cit:CI_Citation>
</mrd:formatSpecificationCitation>
</mrd:MD_Format>
</mrd:distributionFormat>
<!-- TEST INCLUDE -->
<!-- <xsl:include href = "distributor.xsl"/> -->
<xsl:call-template name="distributor.xsl"/>
<!-- TEST INCLUDE -->
<mrd:transferOptions>
<mrd:MD_DigitalTransferOptions>
<mrd:onLine>
<cit:CI_OnlineResource>
<cit:linkage>
<gco:CharacterString>https://my_collections/</gco:CharacterString>
</cit:linkage>
<cit:protocol>
<gco:CharacterString>OGC:WCS</gco:CharacterString>
</cit:protocol>
<cit:name>
<gco:CharacterString><xsl:value-of select="/STAC/metadata/id" /></gco:CharacterString>
</cit:name>
<cit:description>
<gco:CharacterString>DESCRIBE HERE THE RESOURCE</gco:CharacterString>
</cit:description>
<cit:function>
<cit:CI_OnLineFunctionCode codeList="http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#CI_OnLineFunctionCode"
codeListValue="fileAccess"/>
</cit:function>
</cit:CI_OnlineResource>
</mrd:onLine>
</mrd:MD_DigitalTransferOptions>
</mrd:transferOptions>
</mrd:MD_Distribution>
</mdb:distributionInfo>
</mdb:MD_Metadata>
</xsl:template>
</xsl:stylesheet>
these are the two xsl to be included: publication_date.xsl
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<!-- HERE the same namespace as in main.xsl -->
<cit:date>
<cit:CI_Date>
<cit:date>
<gco:Date><xsl:value-of select="/STAC/metadata/creation_time" /></gco:Date>
</cit:date>
<cit:dateType>
<cit:CI_DateTypeCode codeList="http://standards.iso.org/iso/19115/resources/Codelists/cat/codelists.xml#CI_DateTypeCode" codeListValue="publication"/>
</cit:dateType>
</cit:CI_Date>
</cit:date>
</xsl:template>
</xsl:stylesheet>
distributor.xsl
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*"/>
<!-- <xsl:template match="/">-->
<xsl:template name="DOI_publisher.xsl">
<!-- HERE the same namespace as in main.xsl -->
<mrd:distributor>
<mrd:MD_Distributor>
<mrd:distributorContact>
<cit:CI_Responsibility>
<cit:role>
<cit:CI_RoleCode codeList="http://standards.iso.org/iso/19115/resources/Codelists/cat/codelists.xml#CI_RoleCode"
codeListValue="publisher"/>
</cit:role>
<cit:party>
<cit:CI_Organisation>
<cit:name>
<gco:CharacterString>institute2</gco:CharacterString>
</cit:name>
<cit:contactInfo>
<cit:CI_Contact>
<cit:address>
<cit:CI_Address>
<cit:deliveryPoint>
<gco:CharacterString>address2</gco:CharacterString>
</cit:deliveryPoint>
<cit:city>
<gco:CharacterString>city2</gco:CharacterString>
</cit:city>
<cit:administrativeArea>
<gco:CharacterString>area2</gco:CharacterString>
</cit:administrativeArea>
<cit:postalCode>
<gco:CharacterString>Postal_code2</gco:CharacterString>
</cit:postalCode>
<cit:country>
<gco:CharacterString>Nation2</gco:CharacterString>
</cit:country>
<cit:electronicMailAddress>
<gco:CharacterString>email2</gco:CharacterString>
</cit:electronicMailAddress>
</cit:CI_Address>
</cit:address>
</cit:CI_Contact>
</cit:contactInfo>
</cit:CI_Organisation>
</cit:party>
</cit:CI_Responsibility>
</mrd:distributorContact>
</mrd:MD_Distributor>
</mrd:distributor>
</mdb:MD_Metadata>
</xsl:template>
</xsl:stylesheet>
CodePudding user response:
Why not do it using XSLT?
Note, if you've got a series of similar XSLT files and you need to make a similar change to each of them, this is a strong signal that it's time to do some refactoring to improve code re-use. The simplest approach is to extract common code into shared modules that you incorporate using xsl:include
. There are other more elaborate approaches, such as generating the XSLT stylesheets from a common master. The fact that XSLT is XML makes manipulating XSLT using XSLT a very viable technique.
LATER
OK, you've taken my suggestion, and you've modified your question to show where you got to and where you got stuck. That's not actually a very good way of taking things forward on SO: if you keep editing the question and I keep editing the answer, then anyone coming here later will find it very hard to follow. Next time, raise a new question.
You've misunderstood how xsl:include
works. At the point where you've written xsl:include
, replace it with <xsl:call-template name="some.code"/>
. Put the xsl:include
declaration at the top level of the main.xsl
stylesheet (as a child of xsl:stylesheet
), and in the included module, include a named template <xsl:template name="some.code">....</xsl:template>
.