我正在从 Filemaker 12 导出数据以构建 SOAP 调用来更新我们的网站(magento)
除了我需要移动一些节点之外,我几乎可以让一切正常工作
我目前有(片段)
<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
<RESULTSET FOUND="1">
<ROW MODID="4431" RECORDID="31">
<!-- column 15 -->
<COL> <!-- customer group -->
<DATA>all</DATA>
<DATA>all</DATA>
<DATA>education</DATA>
</COL>
<!-- column 16 -->
<COL> <!-- qty -->
<DATA>5</DATA>
<DATA>10</DATA>
<DATA>100</DATA>
</COL>
<!-- column 17 -->
<COL> <!-- sale price -->
<DATA>1300</DATA>
<DATA>1250</DATA>
<DATA>1225</DATA>
</COL>
<!-- column 18 -->
<COL> <!-- website -->
<DATA>1</DATA>
<DATA>1</DATA>
<DATA>2</DATA>
</COL>
</ROW>
</RESULTSET>
</FMPXMLRESULT>
我希望它看起来像:
<item>
<customer_group>all</customer_group
<qty>5</qty>
<price>1300</price>
<website>1</website>
</item>
<item>
<customer_group>all</customer_group
<qty>10</qty>
<price>1250</price>
<website>1</website>
</item>
<item>
<customer_group>education</customer_group
<qty>100</qty>
<price>1225</price>
<website>2</website>
</item>
我当前的样式表看起来像这样(再次只是相关的片段)
<xsl:for-each select="fmp:COL[15]/fmp:DATA">
<xsl:variable name="location">
<xsl:value-of select="position()" />
</xsl:variable>
<item>
<customer_group_id xsi:type="xsd:string">
<xsl:value-of select="//fmp:ROW/fmp:COL[15]/fmp:DATA[$location]" />
</customer_group_id>
<qty xsi:type="xsd:int">
<xsl:value-of select="//fmp:ROW/fmp:COL[16]/fmp:DATA[$location]" />
</qty>
<price xsi:type="xsd:double">
<xsl:value-of select="//fmp:ROW/fmp:COL[17]/fmp:DATA[$location]" />
</price>
<website xsi:type="xsd:string">
<xsl:value-of select="//fmp:ROW/fmp:COL[18]/fmp:DATA[$location]" />
</website>
</item>
</xsl:for-each>
这几乎是可行的,因为它将构建 3 个元素,包括所有 customer_group 、数量、价格和网站,但是,它没有带来任何数据。
任何人都可以帮忙吗?
整个 filemaker 输出在这里:0 2bxdrumit5mk2 201 5511 516 2 1 Drum Machine description here short description 123。45 1 my-url-to-product 4 1700 01/01/2199 02/01/2199 2 所有所有教育 5 10 100 1300 1250 1225 1 1 2 鼓组内容更多文本 0 stock_message 按要求订购1
整个 XSLT 样式表在这里:
<?xml version="1.0" encoding="utf-8" standalone='no'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fmp="http://www.filemaker.com/fmpxmlresult" exclude-result-prefixes="fmp" xmlns:sc="http://schemas.google.com/structuredcontent/2009" xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns:gd="http://schemas.google.com/g/2005" xmlns:scp="http://schemas.google.com/structuredcontent/2009/products">
<xsl:output method="xml" version="1.0" encoding="windows-1251" indent="yes" />
<xsl:template match="/">
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="urn:Magento">
<SOAP-ENV:Body>
<ns1:catalogProductUpdate>
<xsl:for-each select="fmp:FMPXMLRESULT/fmp:RESULTSET/fmp:ROW">
<sessionId xsi:type="xsd:string">sessionIDstring</sessionId>
<product xsi:type="xsd:string">
<xsl:value-of select="fmp:COL[1]/fmp:DATA" />
</product>
<productData>
<categories SOAP-ENC:arrayType="ns:ArrayOfString[1]">
<xsl:for-each select="fmp:COL[2]/fmp:DATA">
<item xsi:type="xsd:string">
<xsl:value-of select="." />
</item>
</xsl:for-each>
</categories>
<websites SOAP-ENC:arrayType="ns:ArrayOfString[1]">
<xsl:for-each select="fmp:COL[3]/fmp:DATA">
<item xsi:type="xsd:string">
<xsl:value-of select="." />
</item>
</xsl:for-each>
</websites>
<name xsi:type="xsd:string">
<xsl:value-of select="fmp:COL[4]/fmp:DATA" />
</name>
<description xsi:type="xsd:string">
<xsl:value-of select="fmp:COL[5]/fmp:DATA" />
</description>
<short_description xsi:type="xsd:string">
<xsl:value-of select="fmp:COL[6]/fmp:DATA" />
</short_description>
<weight xsi:type="xsd:string">
<xsl:value-of select="fmp:COL[7]/fmp:DATA" />
</weight>
<status xsi:type="xsd:string">
<xsl:value-of select="fmp:COL[8]/fmp:DATA" />
</status>
<url_key xsi:type="xsd:string">
<xsl:value-of select="fmp:COL[9]/fmp:DATA" />
</url_key>
<visibility xsi:type="xsd:string">
<xsl:value-of select="fmp:COL[10]/fmp:DATA" />
</visibility>
<category_ids />
<website_ids />
<price xsi:type="xsd:string">
<xsl:value-of select="fmp:COL[11]/fmp:DATA" />
</price>
<special_from_date xsi:type="xsd:string">
<xsl:value-of select="fmp:COL[12]/fmp:DATA" />
</special_from_date>
<special_to_date xsi:type="xsd:string">
<xsl:value-of select="fmp:COL[13]/fmp:DATA" />
</special_to_date>
<tax_class_id xsi:type="xsd:string">
<xsl:value-of select="fmp:COL[14]/fmp:DATA" />
</tax_class_id>
<tier_price SOAP-ENC:arrayType="ns:catalogProductTierPriceEntityArray[1]">
<item_count>
<xsl:value-of select="count(//fmp:ROW/fmp:COL[15]/fmp:DATA)" />
</item_count>
<xsl:variable name="tierCount">
<xsl:value-of select="count(//fmp:ROW/fmp:COL[15]/fmp:DATA)" />
</xsl:variable>
<!-- count how many tiered thingys we have and hope that the data is correct in FM and there are no blank fields -->
<item_var>
<xsl:value-of select="$tierCount" />
</item_var>
<xsl:variable name="count">
<xsl:number />
</xsl:variable>
<xsl:for-each select="fmp:COL[15]/fmp:DATA">
<xsl:variable name="location">
<xsl:value-of select="position()" />
</xsl:variable>
<item>
<customer_group_id xsi:type="xsd:string">
<xsl:value-of select="//fmp:ROW/fmp:COL[15]/fmp:DATA[$location]" />
</customer_group_id>
<qty xsi:type="xsd:int">
<xsl:value-of select="//fmp:ROW/fmp:COL[16]/fmp:DATA[$location]" />
</qty>
<price xsi:type="xsd:double">
<xsl:value-of select="//fmp:ROW/fmp:COL[17]/fmp:DATA[$location]" />
</price>
<website xsi:type="xsd:string">
<xsl:value-of select="//fmp:ROW/fmp:COL[18]/fmp:DATA[$location]" />
</website>
</item>
</xsl:for-each>
</tier_price>
</productData>
</xsl:for-each>
</ns1:catalogProductUpdate>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
</xsl:template>
</xsl:stylesheet>