Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1793 connectés 

  FORUM HardWare.fr
  Programmation
  XML/XSL

  problème de syntaxe

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

problème de syntaxe

n°2255197
khoukhain
Posté le 07-04-2015 à 19:28:24  profilanswer
 

Bonsoir tout le monde,
alors mon problème est le suivant: je veux réaliser un XSLT pour passer d'un xml à un autre mais j'ai un problème de syntaxe
mon fichier xml initial :
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/processdef">
<process id="process" isExecutable="true">
<startEvent id="sid-BEF2442F-5A88-4A2C-8CE7-758BD0DF22D0"/>
<userTask id="sid-615ABB5C-437B-490F-9D80-A7105D034CD3"/>
<sequenceFlow id="sid-06902D8E-B3FD-45C7-BFEC-08306D7CB087" sourceRef="sid-BEF2442F-5A88-4A2C-8CE7-758BD0DF22D0" targetRef="sid-615ABB5C-437B-490F-9D80-A7105D034CD3"/>
<userTask id="sid-57B833D8-D076-46D3-B1B9-58BF917B5186"/>
<sequenceFlow id="sid-FC61B8CB-B40C-4B37-BF0E-0811B72DF0CB" sourceRef="sid-615ABB5C-437B-490F-9D80-A7105D034CD3" targetRef="sid-57B833D8-D076-46D3-B1B9-58BF917B5186"/>
<endEvent id="sid-70E2DB5F-5799-4A57-8D06-9EFD3CD5EC4E"/>
<sequenceFlow id="sid-D18F8537-03B2-4CA1-8F53-13E80EF0C699" sourceRef="sid-57B833D8-D076-46D3-B1B9-58BF917B5186" targetRef="sid-70E2DB5F-5799-4A57-8D06-9EFD3CD5EC4E"/>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_process">
<bpmndi:BPMNPlane bpmnElement="process" id="BPMNPlane_process">
<bpmndi:BPMNShape bpmnElement="sid-BEF2442F-5A88-4A2C-8CE7-758BD0DF22D0" id="BPMNShape_sid-BEF2442F-5A88-4A2C-8CE7-758BD0DF22D0">
<omgdc:Bounds height="30.0" width="30.0" x="122.5" y="111.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-615ABB5C-437B-490F-9D80-A7105D034CD3" id="BPMNShape_sid-615ABB5C-437B-490F-9D80-A7105D034CD3">
<omgdc:Bounds height="80.0" width="100.0" x="197.5" y="86.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-57B833D8-D076-46D3-B1B9-58BF917B5186" id="BPMNShape_sid-57B833D8-D076-46D3-B1B9-58BF917B5186">
<omgdc:Bounds height="80.0" width="100.0" x="342.5" y="86.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-70E2DB5F-5799-4A57-8D06-9EFD3CD5EC4E" id="BPMNShape_sid-70E2DB5F-5799-4A57-8D06-9EFD3CD5EC4E">
<omgdc:Bounds height="28.0" width="28.0" x="487.5" y="112.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="sid-FC61B8CB-B40C-4B37-BF0E-0811B72DF0CB" id="BPMNEdge_sid-FC61B8CB-B40C-4B37-BF0E-0811B72DF0CB">
<omgdi:waypoint x="297.5" y="126.0"/>
<omgdi:waypoint x="342.5" y="126.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-06902D8E-B3FD-45C7-BFEC-08306D7CB087" id="BPMNEdge_sid-06902D8E-B3FD-45C7-BFEC-08306D7CB087">
<omgdi:waypoint x="152.5" y="126.0"/>
<omgdi:waypoint x="197.5" y="126.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-D18F8537-03B2-4CA1-8F53-13E80EF0C699" id="BPMNEdge_sid-D18F8537-03B2-4CA1-8F53-13E80EF0C699">
<omgdi:waypoint x="442.5" y="126.0"/>
<omgdi:waypoint x="487.5" y="126.0"/>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>

 
quant à mon xslt :
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:drools="http://www.jboss.org/drools"
  xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"    xmlns="urn:jbpm.org:jpdl-3.2">
<xsl:template match="bpmn:startevent">
   <start-state>
      <xsl:attribute name="name">
          <xsl:value-of select="@name"/>
      </xsl:attribute>
   </start-state>
</xsl:template>
<xsl:if test="startEvent/@id=sequenceFlow/@sourceRef">
<xsl:template match="bpmn:sequenceFlow">
  <transition>
    <xsl:attribute name = "name">
      <xsl:value-of select="@name"/>
    </xsl:attribute>
    <xsl:attribute name="id">
      <xsl:value-of select="translate(@name,' ','_')"/>
    </xsl:attribute>
    <xsl:attribute name="to">
      <xsl:value-of select="@targetRef"/>
    </xsl:attribute>
  </transition>
</xsl:template>
</xsl:if>
</xsl:stylesheet>

 
mais ce code ne marche pas mlheureusement  :cry:  
Ce que je veux exprimer : je dois tester si l'id du startEvent est égale à sourceRef de sequenceFlow si oui dans ce cas je vais afficher la transition dans mon nouveau xml
svp aidez moiiiii :cry:  :cry:  :cry:  :cry:

mood
Publicité
Posté le 07-04-2015 à 19:28:24  profilanswer
 

n°2284538
gilou
Modérateur
Modzilla
Posté le 02-07-2016 à 13:16:42  profilanswer
 

Citation :

Ce que je veux exprimer : je dois tester si l'id du startEvent est égale à sourceRef de sequenceFlow


Pour ceux que ça pourrait intéresser, la solution pourrait ressembler à:
   

Code :
  1. <xsl:template match="bpmn:startEvent">
  2.    <xsl:variable name="current-id" select="./@id"/>
  3.    <xsl:for-each select="./following-sibling::bpmn:sequenceFlow[@sourceRef = $current-id]">
  4.           <!-- et ici, on fait le traitement voulu -->
  5.    </xsl:for-each>
  6. </xsl:template>


 
ou bien si l'on préfère une évaluation dynamique (à priori moins optimale)
   

Code :
  1. <xsl:template match="bpmn:startEvent">
  2.    <xsl:for-each select="./following-sibling::bpmn:sequenceFlow[@sourceRef = current()/@id]">
  3.           <!-- et ici, on fait le traitement voulu -->
  4.    </xsl:for-each>
  5. </xsl:template>


 
A+,


---------------
There's more than what can be linked! --    Iyashikei Anime Forever!    --  AngularJS c'est un framework d'engulé!  --

Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  XML/XSL

  problème de syntaxe

 

Sujets relatifs
Problème Syntaxe PythonProbleme syntaxe ? [résolu]
[FICO Xpress] étrange erreur - problème syntaxeProbléme syntaxe macro excel 4
[RESOLU][c++] probleme de syntaxe dans un héritageerreur de syntaxe, probleme langage C
[Résolu] Problème syntaxe IE sur lien vers une page avec lecteur mp3Problème de syntaxe. Mettre 2 classes pour une page
[resolu] Probleme de syntaxe dans un UPDATEGros probleme de syntaxe php et/ou html
Plus de sujets relatifs à : problème de syntaxe


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR