Filemaker XSL导入空白字段 [英] Filemaker XSL Importing blank fields

查看:55
本文介绍了Filemaker XSL导入空白字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在学习将XML项导入Filemaker 13时,我遇到了一个问题,使用"xsl:for-each"来获取要导入的多行数据.我一直在使用的XML是 W3学校音乐示例.

In learning to import XML items to Filemaker 13 I've run into a problem using "xsl:for-each" to obtain multiple rows of data for import. The XML I've been using is the W3 Schools Music Example.

我用来转换XML的XSL如下:

The XSL I'm using to convert this XML is as follows:

<?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="Title" TYPE="TEXT"/>
      <FIELD NAME="Artist" TYPE="TEXT"/>
      <FIELD NAME="Country" TYPE="TEXT"/>
      <FIELD NAME="Company" TYPE="TEXT"/>
      <FIELD NAME="Price" TYPE="NUMBER"/>
      <FIELD NAME="Year" TYPE="NUMBER"/>
  </METADATA>

  <RESULTSET>  
    <xsl:for-each select="catalog/cd">   
          <ROW>
        <COL>
          <DATA><xsl:value-of select="catalog/cd/title"/></DATA>
        </COL>
        <COL>
          <DATA><xsl:value-of select="catalog/cd/artist"/></DATA>
        </COL>
        <COL>
          <DATA><xsl:value-of select="catalog/cd/country"/></DATA>
        </COL>
        <COL>
          <DATA><xsl:value-of select="catalog/cd/company"/></DATA>
        </COL>
        <COL>
          <DATA><xsl:value-of select="catalog/cd/price"/></DATA>
        </COL>
        <COL>
          <DATA><xsl:value-of select="catalog/cd/year"/></DATA>
        </COL>       
      </ROW>
      </xsl:for-each>     
  </RESULTSET>
</FMPXMLRESULT>

</xsl:template>
</xsl:stylesheet>

如果删除"xsl:for-each"行,我将可靠地从导入到Filemaker的XML中获取第一条记录.如图所示,在"xsl:for-each"行中,我将获得26个空白记录. XML中有26个项目,这很好,但是我没有任何数据.

If I remove the "xsl:for-each" lines, I will reliably get the first record from the XML imported into Filemaker. With the "xsl:for-each" lines in place as shown, I will get 26 blank records. There are 26 items in the XML, which is good, but I'm not getting any data.

顺便说一句,如果将xsl选择字符串修改为读取"catalog/cd/title [4]",我相信它应该返回XML中的第四条记录,那么我又得到了一条空白记录.

As an aside, if the xsl select string is modified to read "catalog/cd/title[4]", which I believe should return the fourth record in the XML, I again get a blank record.

我在这里想念什么?

推荐答案

for-each内,上下文节点是cd元素,因此您的路径需要相对于该路径,例如<xsl:value-of select="title"/>

Inside of the for-each the context node is a cd element so your paths need to be relative to that e.g. <xsl:value-of select="title"/>

这篇关于Filemaker XSL导入空白字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆