我正在尝试将来自 Campaign Monitor API 的导出导入 FileMaker,但我坚持让 XSLT 与自定义字段一起使用。
我正在尝试键入 ID 和 Mr_or_Mrs 的值。
我想我需要对 key 功能做一些事情,但是我尝试过的任何方法都没有奏效。
XML:
<PagedResult>
<NumberOfPages>1</NumberOfPages>
<OrderDirection>asc</OrderDirection>
<PageNumber>1</PageNumber>
<PageSize>1000</PageSize>
<RecordsOnThisPage>439</RecordsOnThisPage>
<Results>
<Subscriber>
<CustomFields>
<CustomField>
<Key>[Mr_or_Mrs]</Key>
<Value>Mrs_email</Value>
</CustomField>
<CustomField>
<Key>[ID]</Key>
<Value>ABCEF1234</Value>
</CustomField>
</CustomFields>
<Date>2015-06-15 17:40:00</Date>
<EmailAddress>mrssmith@email.com</EmailAddress>
<Name>Mrs Smith</Name>
<ReadsEmailWith/>
<State>Active</State>
</Subscriber>
<Subscriber>
<CustomFields>
<CustomField>
<Key>[Mr_or_Mrs]</Key>
<Value>Mr_email</Value>
</CustomField>
<CustomField>
<Key>[ID]</Key>
<Value>1234567890</Value>
</CustomField>
</CustomFields>
<Date>2015-06-15 17:40:00</Date>
<EmailAddress>jones@gmail.com</EmailAddress>
<Name>Mr Jones</Name>
<ReadsEmailWith/>
<State>Active</State>
</Subscriber>
XSLT:
<?xml version='1.0' encoding='UTF-8'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
<METADATA>
<FIELD NAME="ID" TYPE="TEXT"/>
<FIELD NAME="Name" TYPE="TEXT"/>
<FIELD NAME="Email" TYPE="TEXT"/>
<FIELD NAME="Mr_Mrs" TYPE="TEXT"/>
</METADATA>
<RESULTSET>
<xsl:for-each select="PagedResult/Results/Subscriber">
<ROW>
<COL>
<DATA>*This Is Where I'm Stuck*</DATA>
</COL>
<COL>
<DATA><xsl:value-of select="Name/text()"/></DATA>
</COL>
<COL>
<DATA><xsl:value-of select="EmailAddress/text()"/></DATA>
</COL>
<COL>
<DATA>*This Is Where I'm Stuck*</DATA>
</COL>
</ROW>
</xsl:for-each>
</RESULTSET>
</FMPXMLRESULT>
</xsl:template>
</xsl:stylesheet>
期望的输出:
<?xml version="1.0" encoding="UTF-8"?>
<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
<METADATA>
<FIELD TYPE="TEXT" NAME="ID" />
<FIELD TYPE="TEXT" NAME="Name" />
<FIELD TYPE="TEXT" NAME="Email" />
<FIELD TYPE="TEXT" NAME="Mr_Mrs" />
</METADATA>
<RESULTSET>
<ROW>
<COL>
<DATA>ABCEF1234</DATA>
</COL>
<COL>
<DATA>Mrs Smith</DATA>
</COL>
<COL>
<DATA>mrssmith@email.com</DATA>
</COL>
<COL>
<DATA>Mrs_Email</DATA>
</COL>
</ROW>
<ROW>
<COL>
<DATA>1234567890</DATA>
</COL>
<COL>
<DATA>Mr Jones</DATA>
</COL>
<COL>
<DATA>jones@gmail.com</DATA>
</COL>
<COL>
<DATA>Mr_Email</DATA>
</COL>
</ROW>
</RESULTSET>
</FMPXMLRESULT>
任何帮助将不胜感激。