IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

XSL/XSLT/XPATH XML Discussion :

XSLT sur un fichier avec namespace


Sujet :

XSL/XSLT/XPATH XML

  1. #1
    Membre régulier
    Homme Profil pro
    Inscrit en
    Mai 2007
    Messages
    187
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 54
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Mai 2007
    Messages : 187
    Points : 110
    Points
    110
    Par défaut XSLT sur un fichier avec namespace
    Bonjour

    je n'arrive pas à appliquer mon XSLT sur un fichier avace un namespace particulier...

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <graphml xmlns="http://graphml.graphdrawing.org/xmlns" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:y="http://www.yworks.com/xml/graphml" 
    xmlns:yed="http://www.yworks.com/xml/yed/3" 
    xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns 
    http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd">
      <!--Created by yFiles for Java HEAD-Current-->
      <key for="graphml" id="d0" yfiles.type="resources"/>
    ...
    ...
          <data key="d11">
            <y:ProxyAutoBoundsNode>
              <y:Realizers active="0">
                <y:GroupNode>
    ...
    Mon XSL fonctionne à merveille si je remplace <y: par < et </y: par </ et que je supprime les namespace de mon XML....

    Sinon j'obtient un output vide...

    Mon XSL ressemble à ca :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    <?xml version="1.0" encoding="UTF-8"?>
     
    <xsl:stylesheet version="1.0" 
                    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                    xmlns:xalan="http://xml.apache.org/xalan"
    >	
     
    <xsl:output method="xml" 
                  encoding="UTF-8"
                  indent="yes"
                  xalan:indent-amount="2"/>
     
    <xsl:template match="/">
    <workflows>
    	<workflow id="{graphml/graph/data}">
    		<properties>
    			<xsl:for-each select="graphml/graph/data/*">
    				<xsl:copy> 
    					<xsl:apply-templates select="@* | node()" /> 
     
    ...
    des idées?

    Merci,

    P.

  2. #2
    Modérateur

    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    12 559
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2004
    Messages : 12 559
    Points : 21 621
    Points
    21 621
    Par défaut
    Il faut que tu déclares les namespaces que tu utilises dans la stylesheet, et que tu t'en serves dans tes XPath.
    Difficulté supplémentaire : en XPath il n'y a pas de namespace par défaut, tout ce qui a un namespace doit avoir un préfixe. Pas de préfixe ça veut dire pas de namespace, donc c'est obligé.

    Conclusion, avec ce qu'on voit de ton exemple :

    - Tu dois déclarer un namespace genre xmlns:g="http://graphml.graphdrawing.org/xmlns" dans ta XSLT.

    - Tes XPath doivent être de la forme g:graphml/g:graph/g:data .

    * Note : là j'ai proposé le préfixe g pour graphml, mais tu pourrais aussi bien prendre toto ou zorglub. C'est juste un alias pour pouvoir dire "élément dans le namespace http://graphml.graphdrawing.org/xmlns"

  3. #3
    Membre régulier
    Homme Profil pro
    Inscrit en
    Mai 2007
    Messages
    187
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 54
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Mai 2007
    Messages : 187
    Points : 110
    Points
    110
    Par défaut
    Merci,

    ca marche nickel

    P.

  4. #4
    Membre régulier
    Homme Profil pro
    Inscrit en
    Mai 2007
    Messages
    187
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 54
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Mai 2007
    Messages : 187
    Points : 110
    Points
    110
    Par défaut Question subsidiaire
    Re-bonjour,

    tout marche maintenant comme voulu MAIS : je me retrouve avec les namespace d'entrée dans mon XML de sortie...

    comment faire pour spécifier les namespaces de sortie.

    j'ai
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    <workflows xmlns:yed="http://www.yworks.com/xml/yed/3" 
    xmlns:y="http://www.yworks.com/xml/graphml" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:g="http://graphml.graphdrawing.org/xmlns" 
    xmlns:xalan="http://xml.apache.org/xalan">
    qui correspond à mes ns d'entrée

    j'aimerais
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    <workflows xmlns="http://www.docsea.com/workflows" 
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
               xsi:schemaLocation="http://www.docsea.com/workflows workflows.xsd ">
    qui est le ns de mon xml de sortie

    merci.

  5. #5
    Modérateur

    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    12 559
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2004
    Messages : 12 559
    Points : 21 621
    Points
    21 621
    Par défaut
    Pour virer du résultat les préfixes qui ne doivent pas y être : ajouter l'attribut

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    exclude-result-prefixes="yed y g xalan"
    dans ton <xsl:stylesheet>.
    Tous les namespaces qui s'appliquent aux éléments littéraux créés dans la XSLT sont eux-mêmes considérés littéraux et donc, sont déclarés dans le document produit. Sauf le namespace de xsl: et ceux indiqués dans exclude-result-prefixes.

    Pour ajouter le namespace par défaut

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    xmlns="http://www.docsea.com/workflows"
    , le déclarer dans ton <xsl:stylesheet>.
    Ainsi il s'appliquera à tous les éléments littéraux que tu crées dans ta XSLT, et du coup sera déclaré dans le nœud racine du document produit.

  6. #6
    Membre régulier
    Homme Profil pro
    Inscrit en
    Mai 2007
    Messages
    187
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 54
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Mai 2007
    Messages : 187
    Points : 110
    Points
    110
    Par défaut
    Ca marche MAIS : le nouveau xsi n'est pas pris en compte.

    l'output contient
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    et pas
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    xsi:schemaLocation="http://www.docsea.com/workflows workflows.xsd "
    En tous cas merci, pour le reste c'est nickel!

    P.

  7. #7
    Membre régulier
    Homme Profil pro
    Inscrit en
    Mai 2007
    Messages
    187
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 54
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Mai 2007
    Messages : 187
    Points : 110
    Points
    110
    Par défaut
    En fait ca ne marche qu'a moitié...

    j'ai maintenant :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    <workflows xmlns="http://www.docsea.com/workflows" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <workflow managerRef="purchase2Manager" label="Purchase Request" id="request">
        <properties>
          <property xmlns="" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" name="editPurchase" value="false"/>
          <property xmlns="" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" name="addItems" value="false"/>
          <property xmlns="" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" name="workflowActions" value="true"/>
          <property xmlns="" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" name="modifyItems" value="false"/>
        </properties>
        <natures>
          <nature xmlns="" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" id="REQ" label="En Demande">
        <roles>
    ...

    quand j'avais


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    <workflows xmlns:yed="http://www.yworks.com/xml/yed/3" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:g="http://graphml.graphdrawing.org/xmlns" xmlns:xalan="http://xml.apache.org/xalan">
      <workflow managerRef="purchase2Manager" label="Purchase Request" id="request">
        <properties>
          <property name="editPurchase" value="false"/>
    ...

    les ns se sont rajouté de partout....


    mais je sent qu'ion y est presque!!!

    P.

  8. #8
    Modérateur

    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    12 559
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2004
    Messages : 12 559
    Points : 21 621
    Points
    21 621
    Par défaut
    xsi:schemaLocation n'est pas une déclaration de namespace, c'est un attribut parfaitement normal.
    Il faut donc le traiter comme un attribut, pas comme un namespace. Logique.
    Donc tu le mets sur l'élément dont tu veux qu'il ait cet attribut.

    Citation Envoyé par pdelorme Voir le message
    les ns se sont rajouté de partout....
    Je ne sais pas trop ce que tu as fichu, mais je t'ai dit de déclarer tes namespaces dans ton élément <xsl:stylesheet>, comme ça tous les éléments de ta XSLT en profitent, y compris ceux qui font du XPath et y compris les éléments littéraux qui composeront le document de sortie. D'une pierre deux coups.
    Ne les mets pas ailleurs : tout le monde n'en profitera pas.

    Pour enlever les namespaces qui ne doivent pas apparaître dans le document final, je t'ai déjà dit comment faire.

  9. #9
    Membre régulier
    Homme Profil pro
    Inscrit en
    Mai 2007
    Messages
    187
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 54
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Mai 2007
    Messages : 187
    Points : 110
    Points
    110
    Par défaut
    Mon XSL :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    <?xml version="1.0" encoding="UTF-8"?>
     
    <xsl:stylesheet version="1.0" 
                    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                    xmlns:xalan="http://xml.apache.org/xalan"
                    xmlns:g="http://graphml.graphdrawing.org/xmlns"
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                    xmlns:y="http://www.yworks.com/xml/graphml" 
                    xmlns:yed="http://www.yworks.com/xml/yed/3" 
                    xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd"
                    exclude-result-prefixes="xsl g xalan xsi y yed"
                    >	
     
    <xsl:output method="xml" 
                  encoding="UTF-8"
                  indent="yes"
                  xalan:indent-amount="2"
                  omit-xml-declaration="yes" />
     
    <!-- récupère les identifiants -->
    <!--  Workflow -->
    <xsl:variable name="workflowId_id"  	select="/g:graphml/g:key[@for='graph'][@attr.name='workflowId']/@id" />
    <xsl:variable name="workflowName_id"  	select="/g:graphml/g:key[@for='graph'][@attr.name='workflowName']/@id" />
    <xsl:variable name="workflowManager_id"	select="/g:graphml/g:key[@for='graph'][@attr.name='workflowManager']/@id" />
    <xsl:variable name="workflowNatures_id"	select="/g:graphml/g:key[@for='graph'][@attr.name='natures']/@id" />
    <xsl:variable name="workflowProperties_id"	select="/g:graphml/g:key[@for='graph'][@attr.name='properties']/@id" />
    <xsl:variable name="workflowInitialState_id"	select="/g:graphml/g:key[@for='graph'][@attr.name='initialState']/@id" />
     
    <!--  state -->
    <xsl:variable name="stateCode_id"  			select="/g:graphml/g:key[@for='node'][@attr.name='code']/@id" />
    <xsl:variable name="stateNature_id"      	select="/g:graphml/g:key[@for='node'][@attr.name='nature']/@id" />
    <xsl:variable name="stateProperties_id" 	select="/g:graphml/g:key[@for='node'][@attr.name='properties']/@id" />
    <xsl:variable name="stateRoles_id"      	select="/g:graphml/g:key[@for='node'][@attr.name='roles']/@id" />
    <xsl:variable name="stateOrder_id"      	select="/g:graphml/g:key[@for='node'][@attr.name='order']/@id" />
     
    <!--  action -->
    <xsl:variable name="actionCode_id"  		select="/g:graphml/g:key[@for='edge'][@attr.name='code']/@id" />
    <xsl:variable name="type_id"  				select="/g:graphml/g:key[@for='edge'][@attr.name='type']/@id" />
    <xsl:variable name="method_id" 				select="/g:graphml/g:key[@for='edge'][@attr.name='method']/@id" />
    <xsl:variable name="actionProperties_id" 	select="/g:graphml/g:key[@for='edge'][@attr.name='properties']/@id" />
    <xsl:variable name="actionRoles_id"      	select="/g:graphml/g:key[@for='edge'][@attr.name='roles']/@id" />
     
    <!-- actions -->              
    <xsl:template match="/">
    	<workflow managerRef="{g:graphml/g:graph/g:data[@key=$workflowManager_id]}"
    	          label="{g:graphml/g:graph/g:data[@key=$workflowName_id]}" 
    	          id="{g:graphml/g:graph/g:data[@key=$workflowId_id]}" >
    		<properties>
    			<xsl:for-each select="g:graphml/g:graph/g:data[@key=$workflowProperties_id]/*">
    				<xsl:copy> 
    					<xsl:apply-templates select="@* | node()" /> 
    				</xsl:copy>
    			</xsl:for-each>	
    		</properties>
    		<natures>
    			<xsl:for-each select="g:graphml/g:graph/g:data[@key=$workflowNatures_id]/*">
    				<xsl:copy> 
    					<xsl:apply-templates select="@* | node()" /> 
    				</xsl:copy>
    			</xsl:for-each>	
    		</natures>
    		<states initial_state="{g:graphml/g:graph/g:data[@key=$workflowInitialState_id]}">
    			<xsl:for-each select="g:graphml/g:graph//g:node">
    				<xsl:sort select="g:data[@key=$stateOrder_id]" data-type="number"/>
    				<xsl:apply-templates select="." /> 
    			</xsl:for-each>
    		</states>
    	</workflow>
    </xsl:template>
     
    <!-- tous les noeuds avec un code -->
    <xsl:template match="g:node[g:data[@key=$stateCode_id]]">
    	<xsl:variable name="id_noeud_actuel" select="@id" />
    	<state id="{g:data[@key=$stateCode_id]}"
    		   nature="{g:data[@key=$stateNature_id]}"
    		   label="{g:data/y:ShapeNode/y:NodeLabel}"
    		   order="{g:data[@key=$stateOrder_id]}">
    		<properties>
    			<xsl:for-each select="g:data[@key=$stateProperties_id]/*">
    				<xsl:copy> 
    					<xsl:apply-templates select="@* | node()" /> 
    				</xsl:copy>
    			</xsl:for-each>
    		</properties>
    		<roles>
    			<xsl:for-each select="g:data[@key=$stateRoles_id]/*">
    				<xsl:copy> 
    					<xsl:apply-templates select="@* | node()" /> 
    				</xsl:copy>
    			</xsl:for-each>
    		</roles>
    		<actions>
    			<xsl:for-each select="//g:edge[@source = $id_noeud_actuel]">
    				<xsl:sort select="g:data[@key=$actionCode_id]"/>
    				<xsl:apply-templates select="."/>
    			</xsl:for-each>
    		</actions>
    	</state>    
    </xsl:template>
    <!-- les noueds sans code -->
    <xsl:template match="g:node"/>
     
    <!-- tous les liens avec un code -->
    <xsl:template match="g:edge[g:data[@key=$actionCode_id]]">
    	<xsl:variable name="id_action_cible" select="@target" />
    	<action id="{g:data[@key=$actionCode_id]}"
    	        label="{g:data/y:PolyLineEdge/y:EdgeLabel}"
    	        final_state="{//g:node[@id=$id_action_cible]/g:data[@key=$stateCode_id]}"
    	        type="{g:data[@key=$type_id]}"
    	        method="{g:data[@key=$method_id]}">
    		<roles>
    			<xsl:for-each select="g:data[@key=$actionRoles_id]/*">
    				<xsl:copy> 
    					<xsl:apply-templates select="@* | node()" /> 
    				</xsl:copy>
    			</xsl:for-each>
    		</roles>
    		<properties>
    			<xsl:for-each select="g:data[@key=$actionProperties_id]/*">
    				<xsl:copy> 
    					<xsl:apply-templates select="@* | node()" /> 
    				</xsl:copy>
    			</xsl:for-each>
    		</properties>
    	</action>
    </xsl:template>
    <!-- les actions sans code -->
    <xsl:template match="g:edge"/>
     
    <xsl:template match="@* | node()">
    	<xsl:copy> 
       		<xsl:apply-templates select="@* | node()" /> 
    	</xsl:copy>
    </xsl:template>
    </xsl:stylesheet>
    Mon input :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd">
      <!--Created by yFiles for Java HEAD-Current-->
      <key for="graphml" id="d0" yfiles.type="resources"/>
      <key for="port" id="d1" yfiles.type="portgraphics"/>
      <key for="port" id="d2" yfiles.type="portgeometry"/>
      <key for="port" id="d3" yfiles.type="portuserdata"/>
      <key attr.name="code" attr.type="string" for="node" id="d4">
        <default/>
      </key>
      <key attr.name="nature" attr.type="string" for="node" id="d5">
        <default/>
      </key>
      <key attr.name="properties" for="node" id="d6"/>
      <key attr.name="roles" for="node" id="d7">
        <default/>
      </key>
      <key attr.name="order" attr.type="int" for="node" id="d8">
        <default>0</default>
      </key>
      <key attr.name="url" attr.type="string" for="node" id="d9"/>
      <key attr.name="description" attr.type="string" for="node" id="d10"/>
      <key for="node" id="d11" yfiles.type="nodegraphics"/>
      <key attr.name="Description" attr.type="string" for="graph" id="d12">
        <default/>
      </key>
      <key attr.name="workflowId" attr.type="string" for="graph" id="d13">
        <default/>
      </key>
      <key attr.name="workflowName" attr.type="string" for="graph" id="d14">
        <default/>
      </key>
      <key attr.name="workflowManager" attr.type="string" for="graph" id="d15">
        <default/>
      </key>
      <key attr.name="properties" for="graph" id="d16">
        <default/>
      </key>
      <key attr.name="natures" for="graph" id="d17">
        <default/>
      </key>
      <key attr.name="initialState" attr.type="string" for="graph" id="d18">
        <default/>
      </key>
      <key attr.name="code" attr.type="string" for="edge" id="d19">
        <default/>
      </key>
      <key attr.name="type" attr.type="string" for="edge" id="d20">
        <default/>
      </key>
      <key attr.name="method" attr.type="string" for="edge" id="d21">
        <default/>
      </key>
      <key attr.name="properties" for="edge" id="d22">
        <default/>
      </key>
      <key attr.name="roles" for="edge" id="d23">
        <default/>
      </key>
      <key attr.name="url" attr.type="string" for="edge" id="d24"/>
      <key attr.name="description" attr.type="string" for="edge" id="d25"/>
      <key for="edge" id="d26" yfiles.type="edgegraphics"/>
      <graph edgedefault="directed" id="G">
        <data key="d13"><![CDATA[request]]></data>
        <data key="d14"><![CDATA[Purchase Request]]></data>
        <data key="d15"><![CDATA[purchase2Manager]]></data>
        <data key="d16">
    <property name="editPurchase" value="false" xmlns=""/>
    <property name="addItems" value="false" xmlns=""/>
    <property name="workflowActions" value="true" xmlns=""/>
    <property name="modifyItems" value="false" xmlns=""/>
    <property name="printCompetitionReport" value="false" xmlns=""/>
    </data>
        <data key="d17">
          <nature id="REQ" label="En Demande" xmlns="">
        <roles>
          <role id="MGER"/>
        </roles>
    </nature>
    <nature id="RFQ" label="En Consultation" xmlns="">
        <roles>
          <role id="MGER"/>
        </roles>
    </nature>
     <nature id="ORD" label="En Commande" xmlns="">
    <properties>
    <property name="printCompetitionReport" value="true"/>
    </properties>    
    <roles>
          <role id="MGER"/>
        </roles>
      </nature>
    <nature id="DEL" label="En Livraison" xmlns="">
    <properties>
    <property name="printCompetitionReport" value="true"/>
    </properties>    
        <roles>
          <role id="MGER"/>
        </roles>
    </nature>
    </data>
        <data key="d18"><![CDATA[RNW]]></data>
        <node id="n0" yfiles.foldertype="group">
          <data key="d6"/>
          <data key="d9"/>
          <data key="d11">
            <y:ProxyAutoBoundsNode>
              <y:Realizers active="0">
                <y:GroupNode>
                  <y:Geometry height="432.1474067134964" width="564.8265314408409" x="-1386.5107486536604" y="-344.3950080092302"/>
                  <y:Fill color="#CAECFF84" transparent="false"/>
                  <y:BorderStyle color="#666699" type="dotted" width="1.0"/>
                  <y:NodeLabel alignment="right" autoSizePolicy="node_width" backgroundColor="#99CCFF" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="22.37646484375" modelName="internal" modelPosition="t" textColor="#000000" visible="true" width="564.8265314408409" x="0.0" y="0.0">Boucle Demande de Devis</y:NodeLabel>
                  <y:Shape type="roundrectangle"/>
                  <y:State closed="false" innerGraphDisplayEnabled="false"/>
                  <y:Insets bottom="15" bottomF="15.0" left="15" leftF="15.0" right="15" rightF="15.0" top="15" topF="15.0"/>
                  <y:BorderInsets bottom="71" bottomF="71.13720925713784" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/>
                </y:GroupNode>
                <y:GroupNode>
                  <y:Geometry height="50.0" width="50.0" x="-736.3615384615387" y="-347.15796190850654"/>
                  <y:Fill color="#CAECFF84" transparent="false"/>
                  <y:BorderStyle color="#666699" type="dotted" width="1.0"/>
                  <y:NodeLabel alignment="right" autoSizePolicy="node_width" backgroundColor="#99CCFF" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="22.37646484375" modelName="internal" modelPosition="t" textColor="#000000" visible="true" width="50.0" x="0.0" y="0.0">2</y:NodeLabel>
                  <y:Shape type="roundrectangle"/>
                  <y:State closed="false" innerGraphDisplayEnabled="false"/>
                  <y:Insets bottom="15" bottomF="15.0" left="15" leftF="15.0" right="15" rightF="15.0" top="15" topF="15.0"/>
                  <y:BorderInsets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/>
                </y:GroupNode>
              </y:Realizers>
            </y:ProxyAutoBoundsNode>
          </data>
    Mon output :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    <workflow id="request" label="Purchase Request" managerRef="purchase2Manager">
      <properties>
        <property xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" name="editPurchase" value="false"/>
        <property xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" name="addItems" value="false"/>
        <property xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" name="workflowActions" value="true"/>
        <property xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" name="modifyItems" value="false"/>
        <property xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" name="printCompetitionReport" value="false"/>
      </properties>
      <natures>
        <nature xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" id="REQ" label="En Demande">
        <roles>
          <role id="MGER"/>
        </roles>
    </nature>
        <nature xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" id="RFQ" label="En Consultation">
        <roles>
          <role id="MGER"/>
        </roles>
    </nature>
        <nature xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" id="ORD" label="En Commande">
    <properties>
    <property name="printCompetitionReport" value="true"/>
    </properties>    
    <roles>
          <role id="MGER"/>
        </roles>
      </nature>
        <nature xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" id="DEL" label="En Livraison">
    <properties>
    <property name="printCompetitionReport" value="true"/>
    </properties>    
        <roles>
          <role id="MGER"/>
        </roles>
    </nature>
      </natures>
      <states initial_state="RNW">
        <state order="1" label="Nouvelle Demande" nature="REQ" id="RNW">
          <properties>
            <property xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" name="editPurchase" value="true"/>
            <property xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" name="addItems" value="true"/>
            <property xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" name="modifyItems" value="true"/>
          </properties>
    ...
    il semble que le problème vienne du fait que je copie des noeuds qui n'on pas de ns..

    par exemple "property" :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <property name="editPurchase" value="false" xmlns=""/>
    deviens
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <property xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" name="editPurchase" value="false"/>
    même en supprimant le xmlns=""...

    c'est compliqué ces namespaces....

    Merci en tous cas!

    P.

  10. #10
    Modérateur

    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    12 559
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2004
    Messages : 12 559
    Points : 21 621
    Points
    21 621
    Par défaut
    Oui là c'est compliqué, mais :

    - pourquoi ton xsi:schemaLocation est sur ton <xsl:stylesheet> ? C'est pas un namespace, que je sache ! Mets-le là où il doit être. Je te l'ai déjà dit, essaie les choses que je dis avant de revenir.

    - Je croyais que tu voulais un xmlns="quelquechose" sur ton élément <workflow>. C'est pas le cas ? Si tu en veux un, je t'ai déjà dit comment faire, c'est bon ?

    - Effectivement, les <property> de ton input :
    -- déclarent xmlns="", ce qui signifie qu'elles n'ont pas de namespace. Si tu les copies, elles n'en auront pas non plus. Je ne sais pas si c'est ce que tu veux.
    -- héritent des déclarations de namespace de <graphml> : xmlns:xsi, xmlns:yed et xmlns:y. Si tu les copies, alors elles auront aussi accès à ces déclarations de namespace. Et si ce n'est pas leurs ancêtres dans le document produit qui les en font hériter, alors elles vont les déclarer elles-mêmes.

    => Pour xmlns:xsi, je ne vois pas pourquoi tu essayais de l'exclure de toute façon : il doit être sur ton élément <workflow>, puisqu'il est censé avoir l'attribut xsi:schemaLocation. Mets cet attribut et n'exclus pas xsi.

    => pour xmlns:y et xmlns:yed, on n'y peut rien. Si tu copies, tu les auras. Si tu veux qu'ils disparaissent du document produit, il ne faut pas copier les éléments, il faut les recréer. Avec

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <xsl:element name="{name()}">
    ou

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <xsl:element name="{name()}" namespace="uriDuNamespaceDeWorflow">
    Suivant si tu veux que tes éléments aient un namespace ou pas.

Discussions similaires

  1. Extraction de données avec XSL sur des XML avec namespace
    Par snake264 dans le forum XSL/XSLT/XPATH
    Réponses: 3
    Dernier message: 03/02/2012, 10h16
  2. Enregistrer sur un fichier avec Actionscript
    Par sparil dans le forum Dynamique
    Réponses: 3
    Dernier message: 22/06/2007, 10h00
  3. Informations sur un fichier avec son URL
    Par Kiroukool dans le forum Servlets/JSP
    Réponses: 1
    Dernier message: 16/10/2006, 22h10
  4. [XSLT] Appliquer un traitement xslt sur un fichier XML distant
    Par mabig dans le forum Bibliothèques et frameworks
    Réponses: 1
    Dernier message: 14/03/2006, 09h38
  5. [XSLT] Probleme de selection avec namespaces
    Par Ludo_xml dans le forum XSL/XSLT/XPATH
    Réponses: 2
    Dernier message: 01/06/2005, 14h32

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo