Bonjour,
Je débute en XSLT. J'ai réalisé un export de commande mais j'ai un soucis concernant les codes de réductions.
Ils s'affichent de la manière suivante (toutes les valeurs dans une seule balise séparée par un #. Je ne comprends pas pourquoi cela s'affiche comme cela uniquement pour les codes de réductions car la balise <XSL for-each> me sépare bien les valeurs pour la balise <products>
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
<cart_rules value="1.00 # 27.91" value_tax_excl="0.83 # 23.26" name="EDGA - Extension de garantie 3 ans complémentaire sur les débroussailleuses HONDA # NMTC - 5% de remise sur votre commande"/>
Alors que je souhaiterais affiché cela de la manière suivante
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
 
<cart_rules> 
<cart_rule>
<name>EDGA - Extension de garantie 3 ans complémentaire sur les débroussailleuses HONDA</name>
< value_tax_excl>0.83</ value_tax_excl>
<value>1.00</value>
</cart_rule>
<cart_rule>
<name> NMTC - 5% de remise sur votre commande</name>
< value_tax_excl>23.26</ value_tax_excl>
<value>27.91</value>
</cart_rule>
</cart_rules>
Voici mon XSLT
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
 
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8" indent="yes" doctype-public="-//W3C//DTD XHTML 1.0 Strict//FR" />
 
<xsl:key use="order_id" match="/nvn_export_orders/order" name="groups"/>
<xsl:template match="/">
<xsl:apply-templates select="/nvn_export_orders" />
</xsl:template>
<xsl:template match="/nvn_export_orders">
 
<!-- FIRST ROW AND WRAPPER-->
 
<eExact xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="eExact-Schema.xsd">
  <Orders>
     <xsl:for-each select="order[generate-id(.)=generate-id(key('groups',order_id))]">
      <!--COMMON VALUES HERE-->
    <order>
	<id><xsl:value-of select="order_id"/></id>
	<total_shipping_excl><xsl:value-of select="total_shipping_tax_excl"/></total_shipping_excl>
	<total_shipping_incl><xsl:value-of select="total_shipping_tax_incl"/></total_shipping_incl>
	<total_products_wt><xsl:value-of select="total_products_wt"/></total_products_wt>
	<total_products><xsl:value-of select="total_products"/></total_products>
	<totalpaid><xsl:value-of select="totalpaid"/></totalpaid>
	<total_paid_real><xsl:value-of select="total_real_paid"/></total_paid_real>
	<payment><xsl:value-of select="payment"/></payment>	
	<current_state><xsl:value-of select="order_state_id"/></current_state>	
	<reference><xsl:value-of select="order_reference"/></reference>
	<date_add><xsl:value-of select="date_add"/></date_add>
	</order>
 
	<carrier>
	<name><xsl:value-of select="carrier_name"/></name>
	</carrier>
 
 
	<customer>
	<id><xsl:value-of select="id_customer"/></id>
	<email><xsl:value-of select="email"/></email>
	<firstname><xsl:value-of select="first_name"/></firstname>
	<lastname><xsl:value-of select="last_name"/></lastname>
	<siret><xsl:value-of select="siret"/></siret>
	<ape><xsl:value-of select="ape"/></ape>
	<note><xsl:value-of select="private_note"/></note>
 
	</customer>
	<address_delivery>
<xsl:choose> 
    <xsl:when test="(delivery_company = '.')">
	<company/>
    </xsl:when> 
    <xsl:otherwise> 
	<company><xsl:value-of select="delivery_company"/></company>
    </xsl:otherwise> 
</xsl:choose>
 
		<firstname><xsl:value-of select="calcfield_5"/></firstname>
		<lastname><xsl:value-of select="delivery_lastname"/></lastname>
		<phone_mobile><xsl:value-of select="delivery_mobilephone"/></phone_mobile>
		<delivery_phone><xsl:value-of select="delivery_phone"/></delivery_phone>
		<address1><xsl:value-of select="delivery_address1"/></address1>
		<address2><xsl:value-of select="delivery_address2"/></address2>
		<postcode><xsl:value-of select="delivery_postcode"/></postcode>
		<city><xsl:value-of select="delivery_city"/></city>
		<country><xsl:value-of select="delivery_country"/></country>
    </address_delivery>
	<address_invoice>
		<xsl:choose> 
    <xsl:when test="(invoice_company = '.')">
	<company/>
    </xsl:when> 
    <xsl:otherwise> 
	<company><xsl:value-of select="invoice_company"/></company>
    </xsl:otherwise> 
</xsl:choose>
		<firstname><xsl:value-of select="invoice_firstname"/></firstname>
		<lastname><xsl:value-of select="invoice_lastname"/></lastname>
		<phone_mobile><xsl:value-of select="invoice_mobilephone"/></phone_mobile>	
		<invoice_phone><xsl:value-of select="invoice_phone"/></invoice_phone>
		<address1><xsl:value-of select="invoice_address1"/></address1>
		<address2><xsl:value-of select="invoice_address2"/></address2>
		<postcode><xsl:value-of select="invoice_postcode"/></postcode>
		<city><xsl:value-of select="invoice_city"/></city>
		<country><xsl:value-of select="invoice_country"/></country>
    </address_invoice>
 
	<messages>
	<note><xsl:value-of select="message"/></note>
	</messages>
 
	<products>
     <xsl:for-each select="key('groups',order_id)">
              <!--ROWS ITEMS HERE-->
      <product>
	  <lineNo><xsl:value-of select="position()"/></lineNo>
	  <product_id><xsl:value-of select="product_id"/></product_id>
	  <pack><xsl:value-of select="is_pack"/></pack>
	  <product_reference><xsl:value-of select="product_reference"/></product_reference>
	  <product_name><xsl:value-of select="product_name"/></product_name>
	  <product_quantity><xsl:value-of select="product_quantity"/></product_quantity>
	   <product_price><xsl:value-of select="product_price"/></product_price>
		<unit_price_tax_excl><xsl:value-of select="unit_price_tax_excl"/></unit_price_tax_excl>
	<unit_price_tax_incl><xsl:value-of select="unit_price_tax_incl"/></unit_price_tax_incl>
	   <total_price_tax_excl><xsl:value-of select="total_price_tax_excl"/></total_price_tax_excl>
	   <total_price_tax_incl><xsl:value-of select="total_price_tax_incl"/></total_price_tax_incl>
	   <ecotax><xsl:value-of select="eco_tax"/></ecotax>
		<tax_rate><xsl:value-of select="taxtaxrate"/></tax_rate>
		<product_ean13><xsl:value-of select="product_ean13"/></product_ean13>
      </product>
 
       </xsl:for-each>
		</products>
 
		<cart_rules>	
		     <xsl:for-each select="key('groups',order_id)">  
			  <xsl:attribute name="name"><xsl:value-of select="voucher_name"/></xsl:attribute>
			  <xsl:attribute name="value_tax_excl"><xsl:value-of select="voucher_value_tax_excl"/></xsl:attribute>
			  <xsl:attribute name="value"><xsl:value-of select="voucher_value"/></xsl:attribute>
			</xsl:for-each>
		</cart_rules>  
      </xsl:for-each>
  </Orders>
</eExact>
  </xsl:template>
</xsl:stylesheet>
Merci par avance pour votre aide.