Developer forum

Forum » Development » Custom .xml (import/export module)

Custom .xml (import/export module)


Reply
I'm using the import/export extended module to create a .xml file with info about all products in eCom. This should be done automatically once a day.

But first of all. The output I get is:

<Products>
  <Product>
    <ProductID>PROD127</ProductID>
    <ProductLanguageID>LANG1</ProductLanguageID>
    <ProductVariantID>VO59</ProductVariantID>
    <ProductGroupID>GROUP10</ProductGroupID>
    <ProductNumber>ON10_24008643</ProductNumber>
    <ProductName>T-shirt</ProductName>
    <ProductShortDescription>&lt;br type="_moz" /&gt;</ProductShortDescription>
    <ProductLongDescription>&lt;br type="_moz" /&gt;</ProductLongDescription>
    <ProductImageSmall />
    <ProductImageMedium />
    <ProductImageLarge />
    <ProductLink1 />
    <ProductLink2 />
    <ProductPrice>99</ProductPrice>
    <ProductStock>3</ProductStock>
    <ProductWeight>0</ProductWeight>
    <ProductVolume>0</ProductVolume>
    <ProductManufacturerID>MANU3</ProductManufacturerID>
    <ProductActive>True</ProductActive>
    <ProductPeriodID />
  </Product> </Products>

I just need it to look like this instead:

<import>
<tilbud>

<tilbudId></tilbudId>
<tilbudNavn></tilbudNavn>
<tilbudBeskrivelse></tilbudBeskrivelse>
<tilbudPrisVejl></tilbudPrisVejl>
<tilbudPrisFoer></tilbudPrisFoer>
<tilbudPrisNu></tilbudPrisNu>
<ehandelLink><!></ehandelLink>

<kategorier>
<kategori>
<kategoriNummer></kategoriNummer>
<kategoriNavn></kategoriNavn>
<kategoriURL></kategoriURL>
</kategori>
</kategorier>

<billedeURL></billedeURL>

</tilbud>
</import>


How is that possible? I need to customise the output I get, but can't figure out where to do that.


Replies

 
Reply
Hi Michael,

Insert an XSLT transformation before your XML file destination. Then you can transform the product XML to the format you want using XSLT.

BR.
Lars
 
Reply
Okay (I'm pretty new to this xslt, xlm and import/export, so bear with me).

But I can't get it to work. My pipeline now looks like this:
-----
- Product kilde (product source)

- XSL Transformering (XSL transform)

- XML destinationsfil (xml destination)
-----

Options for XSL transform:

I've made this file in dreamweaver "filename.xsl" containing:
http://textsnip.com/253447/html

- and linked to it in the options panel for XSL transform.

I'm guessing that my .xsl file is incorrect, is that right? And how should it look?
 
Reply
I don't know if it's just poor rendering of the file on this page, but I can't see you're merging anything anywhere. E.g. your <tilbudid></tilbudid> should contain <xsl:value-of select="ProductID" /> (can't rember the exact xml fieldname).

Try removing XSLT transform activity temporarily so your XML destination file will contain the clean product xml. Review that file to get the precise fields.

BR.
Lars
 
Reply
Sorry, forgot you had the XML already:)

If you line 16 should contain something like <xsl:template match="/Products/Product">, <tilbudId><xsl:value-of select="ProductID" /></tilbudId> should work.

BR.
Lars
 
Reply
I'm still not getting the output I'm looking for.

my transform.xsl file now looks like this:

http://textsnip.com/6cbc91/html

But my output .xml file looks like this (I'm just showing the first product):

http://textsnip.com/d702a9/html

When running the pipeline, I actually get a log in the pop-up window:

9:32 AM XSL transformering Error initializing activity: XSLT compile error.
9:32 AM XSL transformering Process error: No stylesheet was loaded.
9:32 AM XML destinationsfil Process error: Value cannot be null.
Parameter name: s
9:32 AM XSL transformering Process error: No stylesheet was loaded.
9:32 AM XML destinationsfil Process error: Value cannot be null.
Parameter name: s

-and so on..

 

You must be logged in to post in the forum