I'm constructing a XML schema with XSLT using just one specific value from the input schema. My goal is to construct a generic xslt for other documents.
Here is my input xsd simplified :
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:nr0="http://NamespaceTest.com/balisesXrm" xmlns:xalan="http://xml.apache.org/xslt" xmlns:SCCOAMCD="urn:SCCOA-schemaInfo" xmlns="urn:SBEGestionZonesAeriennesSYSCA-schema" xmlns:SBEGestionZonesAeriennesSYSCA="urn:SBEGestionZonesAeriennesSYSCA-schema" SCCOAMCD:desc=" implémentation du MCD pivot du SCCOA 3.2.1ec production par SCCOA mcd2mpd 4.1.1, le 11/12/2007 règles spécifiques production schémas 1.2 diagramme : A-SC.SBE GestionZonesAeriennes SYSCA entité racine : A-SC.ZoneAerienne " attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="urn:SBEGestionZonesAeriennesSYSCA-schema" version="3.2.1ec">
<xsd:element name="SBEGestionZonesAeriennesSYSCA" type="SBEGestionZonesAeriennesSYSCA:type_SBEGestionZonesAeriennesSYSCA"/>
<xsd:schema>
I writted this xslt :
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:xdt="http://www.w3.org/2005/xpath-datatypes"
xmlns:err="http://www.w3.org/2005/xqt-errors"
exclude-result-prefixes="xsd xdt err fn"
xmlns:redirect="http://xml.apache.org/xalan/redirect"
extension-element-prefixes="redirect"
xmlns:xalan="http://xml.apache.org/xslt">
<xsl:output method="xml" indent="yes" xalan:indent-amount="4"/>
<xsl:template match="xsd:schema">
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SBEGestionZonesAeriennesSYSCA="urn:SBEGestionZonesAeriennesSYSCA-schema"
xmlns:xrm="http://www.moss.fr/2011/connecteur_xrm" xmlns:nr0="http://NamespaceTest.com/balisesXrm" xmlns:SCCOAMCD="urn:SCCOA-schemaInfo" xmlns:metier="urn:SBEGestionZonesAeriennesSYSCA-schema" targetNamespace="http://www.moss.fr/2011/connecteur_xrm" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xsl:call-template name="importbalisesXrm"/>
<xsl:call-template name="importNamespaceXrm"/>
<xsl:apply-templates/>
<xsl:call-template name="mapping"/>
</xsd:schema>
</xsl:template>
<xsl:template name="mapping">
<xsd:complexType name="mapping">
<xsd:sequence>
<xsd:element ref="{xsd:element/@name}" namespace="urn:SBEGestionZonesAeriennesSYSCA-schema"/>
</xsd:sequence>
<xsd:attribute name="occurs"></xsd:attribute>
</xsd:complexType>
</xsl:template>
</xsl:stylesheet>
My problem is with this instruction, the output XSD gives me ref="SBEGestionZonesAeriennesSYSCA" while i would like ref="metier:SBEGestionZonesAeriennesSYSCA".
Hope someone has an idea to add a prefix with the value-of command.