user25627

XSLT Question Regarding XML Import

Discussion created by user25627 on Sep 23, 2016
Latest reply on Sep 27, 2016 by beverly

Hi there,

 

I'm trying to Import XML documents by way of an XSLT file into Filemaker. Most nodes work just fine, however, for the highlighted node "CONT" I want to Import everything between the <CONT> and </CONT> tags incl. markup etc. This I didn't manage so far.

 

Any help is very much appreciated!

Pete

 

XML source document

<?xml version="1.0" encoding="UTF-8"?>

<UnitXml>

<HEAD>

  <PTO>

   <CPN>850</CPN>

   <CO>US</CO>

  </PTO>

</HEAD>

<BODY>

  <PPICONTAINER>

   <PPI>

    <VP>22</VP>

    <JC>02</JC>

    <CF>00</CF>

    <CONT>

     <Double/>

     <space/>

     <space/>

     <space/>

     <space/>

     <StartBox/>

     <StartBox/>

     Text

     <EndBox/>

     <EndBox/>

    </CONT>

   </PPI>

   <PPI>

    <VP>20</VP>

    <JC>02</JC>

    <CF>00</CF>

   <CONT>

     <Double/>

     <StartBox/>

     <StartBox/>

     Welcome

     <space/>

     to

     <space/>

     the

     <space/>

     &quot;US&quot;.

     <EndBox/>

     <EndBox/>

     <newline/>

     <newline/>

     <Double/>

     <space/>

     <space/>

     <space/>

     <space/>

     <space/>

     <StartBox/>

     <StartBox/>

     Hello again.

     <EndBox/>

     <EndBox/>

    </CONT>

   </PPI>

   </PPICONTAINER>

</BODY>

</UnitXml>

 

XSLT document

<?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="CPN" TYPE="TEXT"/>

    <FIELD NAME="CO" TYPE="TEXT"/>

   </METADATA>

   <RESULTSET>

   <xsl:for-each select="/StlXml/BODY/TTICONTAINER/TTI">

    <ROW RECORDID="" MODID="">

     <COL>

      <DATA>

       <xsl:value-of select="VP"/>

      </DATA>

     </COL>

     <COL>

      <DATA>

       <xsl:value-of select="JC"/>

      </DATA>

     </COL>

     <COL>

      <DATA>

       <xsl:value-of select="CF"/>

      </DATA>

     </COL>

     <COL>

      <DATA>

       <xsl:copy-of select="CONT??????????????????"/>

      </DATA>

     </COL>

    </ROW>

   </xsl:for-each>

   </RESULTSET>

  </FMPXMLRESULT>

</xsl:template>

</xsl:stylesheet>

Outcomes