The XSLT enables a conversion of any document of any format to a different format in particular the one supported by the module.
Creation via the online tool
To faciliate the spelling of the XSLT, a free online tool exists (deprecated): http://xslt.prestashopxmlimporter.madef.fr
To help you to edit your XSLT, a free online tool exists and display the render of the XML on live: http://xslt.prestashopxmlimporter.madef.fr/live.php
This tool enables the creation of the XSLT for the flow product without any particular knowledge. Therefore, it is necessary to have a minimum knowledge on the XML format and on the features of the PrestaShop products.
Examples of use of the XSLT
Example with two specified prices and stocks:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
<!ENTITY copy "©">
<!ENTITY reg "®">
<!ENTITY trade "™">
<!ENTITY mdash "—">
<!ENTITY ldquo "“">
<!ENTITY rdquo "”">
<!ENTITY pound "£">
<!ENTITY yen "¥">
<!ENTITY euro "€">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="utf-8" indent="yes"/>
<xsl:variable name="cdataStart"><![CDATA[ <![CDATA ]]></xsl:variable>
<xsl:variable name="cdataEnd"><![CDATA[ ]] ]]></xsl:variable>
<xsl:template match="/VFPData">
<xsl:comment> XSLT Generated by http://prestashopxmlimporter.madef.fr/xslt.php the 2014-06-04 10:34 </xsl:comment>
<products>
<xsl:for-each select="mercator_stock">
<product>
<xsl:if test="./s_modele">
<name lang="en"><xsl:value-of select="./s_modele" /></name>
</xsl:if>
<xsl:if test="./s_prix_ti">
<price><xsl:value-of select="./s_prix_ti" /></price>
</xsl:if>
<xsl:if test="./s_recupel">
<recupel><xsl:value-of select="./s_recupel" /></recupel>
</xsl:if>
<xsl:if test="./s_auvibel">
<auvibel><xsl:value-of select="./s_auvibel" /></auvibel>
</xsl:if>
<xsl:if test="./s_bebat">
<bebat><xsl:value-of select="./s_bebat" /></bebat>
</xsl:if>
<xsl:if test="./s_cle1">
<reference><xsl:value-of select="./s_cle1" /></reference>
</xsl:if>
<xsl:if test="./s_cle2">
<ean13><xsl:value-of select="./s_cle2" /></ean13>
</xsl:if>
<xsl:if test="./s_sommeil">
<active><xsl:value-of select="./s_sommeil" /></active>
</xsl:if>
<block>
<xsl:if test="./s_qdispo">
<stocks>
<stock>
<product>{{id}}</product>
<mode>set</mode>
<quantity><xsl:value-of select="./s_qdispo" /></quantity>
</stock>
</stocks>
</xsl:if>
<xsl:if test="./s_tarht_1">
<objects>
<object type="specificPrice">
<xsl:attribute name="external-reference">{{id}}-1</xsl:attribute>
<id_product>{{id}}</id_product>
<id_group>4</id_group>
<id_customer>0</id_customer>
<id_shop>1</id_shop>
<id_country>0</id_country>
<id_currency>1</id_currency>
<from>0000-00-00</from>
<to>0000-00-00</to>
<price><xsl:value-of select="./s_tarht_1" /></price>
<reduction>0</reduction>
<reduction_type>amount</reduction_type>
<from_quantity>1</from_quantity>
</object>
</objects>
</xsl:if>
<xsl:if test="./s_tarht_2">
<objects>
<object type="specificPrice">
<xsl:attribute name="external-reference">{{id}}-2</xsl:attribute>
<id_product>{{id}}</id_product>
<id_group>5</id_group>
<id_customer>0</id_customer>
<id_shop>1</id_shop>
<id_country>0</id_country>
<id_currency>1</id_currency>
<from>0000-00-00</from>
<to>0000-00-00</to>
<price><xsl:value-of select="./s_tarht_2" /></price>
<reduction>0</reduction>
<reduction_type>amount</reduction_type>
<from_quantity>1</from_quantity>
</object>
</objects>
</xsl:if>
</block>
</product>
</xsl:for-each>
</products>
</xsl:template>
</xsl:stylesheet>