Filemaker xml 导出相关项目
Filemaker xml export of related items
我花了一些时间搜索 stackoveflow 数据库;无法找到帮助解决以下问题的示例。这是 FMP 导出:
<?xml version="1.0" encoding="UTF-8" ?>
<FMPDSORESULT xmlns="http://www.filemaker.com/fmpdsoresult">
<ERRORCODE>0</ERRORCODE>
<DATABASE>catalogus.fmp12</DATABASE>
<LAYOUT>items</LAYOUT>
<ROW MODID="178" RECORDID="560">
<sub_group>This is the title</sub_group>
<description>This is the description</description>
<item_number><DATA>010050</DATA><DATA>010350</DATA></item_number>
<item_name><DATA>UNIVERSAL PUMP</DATA><DATA>SPARE PARTS SET</DATA></item_name>
</ROW>
</FMPDSORESULT>
样式表一切正常:
<?xml version='1.0' encoding='utf-8'?>
<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:fm="http://www.filemaker.com/fmpdsoresult" exclude-result-prefixes="fm">
<xsl:output version='1.0' encoding='UTF-8' indent='yes' method='xml' />
<xsl:template match="/">
<items>
<xsl:for-each select="fm:FMPDSORESULT/fm:ROW">
<item>
<sub_group>
<xsl:value-of select="./fm:sub_group" />
</sub_group>
<description>
<xsl:value-of select="./fm:description" />
</description>
<subitems>
<xsl:for-each select="?????????????????????">
<related>
<xsl:value-of select="."/>
</related>
</xsl:for-each>
</subitems>
</item>
</xsl:for-each>
</items>
</xsl:template>
</xsl:stylesheet>
这给出:
<?xml version="1.0" encoding="UTF-8"?>
<items>
<item>
<sub_group>This is the title</sub_group>
<description>This is the description</description>
<subitems>
</subitems>
</item>
</items>
我希望得到类似的东西:
This is the title
This is the description
010050 Universal Pump
010350 Spare Parts Set
获取这些相关值的正确格式应该是什么?
感谢帮助。对我来说,这个 xml/InDesign 项目是更加熟悉 xml.
的完美方式
我无法确定您想要的输出格式。尝试更换有问题的部分:
<subitems>
<xsl:for-each select="?????????????????????">
<related>
<xsl:value-of select="."/>
</related>
</xsl:for-each>
</subitems>
与:
<subitems>
<xsl:for-each select="fm:item_number/fm:DATA">
<xsl:variable name="i" select="position()" />
<subitem>
<item_number>
<xsl:value-of select="."/>
</item_number>
<item_name>
<xsl:value-of select="../../fm:item_name/fm:DATA[$i]"/>
</item_name>
</subitem>
</xsl:for-each>
</subitems>
这应该会产生以下结果:
<?xml version="1.0" encoding="UTF-8"?>
<items>
<item>
<sub_group>This is the title</sub_group>
<description>This is the description</description>
<subitems>
<subitem>
<item_number>010050</item_number>
<item_name>UNIVERSAL PUMP</item_name>
</subitem>
<subitem>
<item_number>010350</item_number>
<item_name>SPARE PARTS SET</item_name>
</subitem>
</subitems>
</item>
</items>
我花了一些时间搜索 stackoveflow 数据库;无法找到帮助解决以下问题的示例。这是 FMP 导出:
<?xml version="1.0" encoding="UTF-8" ?>
<FMPDSORESULT xmlns="http://www.filemaker.com/fmpdsoresult">
<ERRORCODE>0</ERRORCODE>
<DATABASE>catalogus.fmp12</DATABASE>
<LAYOUT>items</LAYOUT>
<ROW MODID="178" RECORDID="560">
<sub_group>This is the title</sub_group>
<description>This is the description</description>
<item_number><DATA>010050</DATA><DATA>010350</DATA></item_number>
<item_name><DATA>UNIVERSAL PUMP</DATA><DATA>SPARE PARTS SET</DATA></item_name>
</ROW>
</FMPDSORESULT>
样式表一切正常:
<?xml version='1.0' encoding='utf-8'?>
<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:fm="http://www.filemaker.com/fmpdsoresult" exclude-result-prefixes="fm">
<xsl:output version='1.0' encoding='UTF-8' indent='yes' method='xml' />
<xsl:template match="/">
<items>
<xsl:for-each select="fm:FMPDSORESULT/fm:ROW">
<item>
<sub_group>
<xsl:value-of select="./fm:sub_group" />
</sub_group>
<description>
<xsl:value-of select="./fm:description" />
</description>
<subitems>
<xsl:for-each select="?????????????????????">
<related>
<xsl:value-of select="."/>
</related>
</xsl:for-each>
</subitems>
</item>
</xsl:for-each>
</items>
</xsl:template>
</xsl:stylesheet>
这给出:
<?xml version="1.0" encoding="UTF-8"?>
<items>
<item>
<sub_group>This is the title</sub_group>
<description>This is the description</description>
<subitems>
</subitems>
</item>
</items>
我希望得到类似的东西:
This is the title
This is the description
010050 Universal Pump
010350 Spare Parts Set
获取这些相关值的正确格式应该是什么? 感谢帮助。对我来说,这个 xml/InDesign 项目是更加熟悉 xml.
的完美方式我无法确定您想要的输出格式。尝试更换有问题的部分:
<subitems>
<xsl:for-each select="?????????????????????">
<related>
<xsl:value-of select="."/>
</related>
</xsl:for-each>
</subitems>
与:
<subitems>
<xsl:for-each select="fm:item_number/fm:DATA">
<xsl:variable name="i" select="position()" />
<subitem>
<item_number>
<xsl:value-of select="."/>
</item_number>
<item_name>
<xsl:value-of select="../../fm:item_name/fm:DATA[$i]"/>
</item_name>
</subitem>
</xsl:for-each>
</subitems>
这应该会产生以下结果:
<?xml version="1.0" encoding="UTF-8"?>
<items>
<item>
<sub_group>This is the title</sub_group>
<description>This is the description</description>
<subitems>
<subitem>
<item_number>010050</item_number>
<item_name>UNIVERSAL PUMP</item_name>
</subitem>
<subitem>
<item_number>010350</item_number>
<item_name>SPARE PARTS SET</item_name>
</subitem>
</subitems>
</item>
</items>