如何将XML导入filemaker pro或MS Access?

时间:2014-03-19 23:53:59

标签: xml database ms-access import filemaker

我有一组XML文件以及我想要导入到filemaker pro数据库或MS访问中的样式表和模式。问题是,每次我选择要导入的XML文件,然后选择样式表我都会在尝试导入时出错     在filemaker或access中是否存在我需要指定Schema文件的地方?因为我认为这就是问题所在 感谢

样式表称为spl.xsl

<!--

The contents of this file are subject to the Health Level-7 Public
License Version 1.0 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of the
License at http://www.hl7.org/HPL/hpl.txt.

Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and
limitations under the License.

The Original Code is all this file.

The Initial Developer of the Original Code is Gunther Schadow.
Portions created by Initial Developer are Copyright (C) 2002-2004
Health Level Seven, Inc. All Rights Reserved.

Contributor(s): Steven Gitterman, Brian Keller

Revision: $Id: spl.xsl,v 1.52 2005/08/26 05:59:26 gschadow Exp $

Revision: $Id: spl-common.xsl,v 2.0 2006/08/18 04:11:00 sbsuggs Exp $

-->
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:v3="urn:hl7-org:v3" version="1.0" exclude-result-prefixes="v3 xsl">
<xsl:import href="spl-common.xsl"/>
<!--  Where to find JavaScript resources  -->
<xsl:param name="resourcesdir">http://www.accessdata.fda.gov/spl/stylesheet/</xsl:param>
<!--
 Whether to show the clickable XML, set to "/.." instead of "1" to turn off 
-->
<xsl:param name="show-subjects-xml" select="/.."/>
<!--
 Whether to show the data elements in special tables etc., set to "/.." instead of "1" to turn off 
-->
<xsl:param name="show-data" select="1"/>
<!--  This is the CSS link put into the output  -->
<xsl:param name="css">
http://www.accessdata.fda.gov/spl/stylesheet/spl.css
</xsl:param>
<!--
 Whether to show section numbers, set to 1 to enable and "/.." to turn off
-->
<xsl:param name="show-section-numbers" select="/.."/>
<!--  Whether to process mixins  -->
<xsl:param name="process-mixins" select="true()"/>
<xsl:param name="core-base-url">http://www.accessdata.fda.gov/spl/core</xsl:param>
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>
</xsl:transform>

https://drive.google.com/folderview?id=0Bx_in_8GQ_x5MGNuQXlSbHJXRzA&usp=sharing

XML文件示例:只有1个文件 https://drive.google.com/folderview?id=0Bx_in_8GQ_x5T3R4X2lXNzY0cXc&usp=sharing

1 个答案:

答案 0 :(得分:0)

这是一个可以用作起点的XSLT样式表。它为<component>部分中的每个顶级<structuredBody>元素创建记录(ROW)。然后,它从root元素的<id>元素的<section>属性中获取值。

这将被引导到名为“RootID”的FIELD。您将在Filemaker的导入对话框中看到此字段,您将能够将其映射到目标表中的字段 - 与从“真实”Filemaker文件导入相同。

我建议您暂时使用此功能并尝试向导入树添加更多数据。然后,如果您有更具体的问题要问,请将它们发布。但是,您需要具备一些基本的XSLT专有技术才能解决这个问题。

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:hl7="urn:hl7-org:v3"
exclude-result-prefixes="hl7">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

<xsl:template match="/">

<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
<ERRORCODE>0</ERRORCODE>
<PRODUCT BUILD="" NAME="" VERSION=""/>
<DATABASE DATEFORMAT="" LAYOUT="" NAME="" RECORDS="" TIMEFORMAT=""/>

<METADATA>
    <FIELD NAME="RootID" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT="1" />
    <!-- add more fields here -->   
</METADATA>

<RESULTSET FOUND="">
<xsl:for-each select="hl7:document/hl7:component/hl7:structuredBody/hl7:component">
<ROW>
        <COL><DATA><xsl:value-of select="hl7:section/hl7:id/@root"/></DATA></COL>
            <!-- add more columns here -->
</ROW>
</xsl:for-each>

</RESULTSET>
</FMPXMLRESULT>

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