AnsweredAssumed Answered

XML Import and Namespace - XSL Help

Question asked by laural4705 on Apr 5, 2018
Latest reply on Apr 6, 2018 by beverly

I need some help with XML/XSL ...  I have static xml file that I am using for testing purposes, eventually I want to pull in the data via a URL.  The problem is that when I try to import the below xml with the xsl that is under it, I get the import box, but no data...

 

If I removed the value http://schemas.datacontract.org/2004/07/Mayo.ContentDelivery.Models from the line xlmns="http://schemas.datacontract.org/2004/07/Mayo.ContentDelivery.Models" so it is xlmns="", then the information imports fine.

 

Since I cannot changed the XML from the URL, I assume that I need to make a fix in my XSL file, I just don't know what that would be.  Anyone have any idea?  Thanks for any input!

 

<ArrayOfContentMetadata xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Mayo.ContentDelivery.Models">

     <ContentMetadata>

          <ContentId>ABT-20333729</ContentId>

          <LanguageCode>en</LanguageCode>

          <MediaPath i:nil="true"/>

          <Status>Active</Status>

          <Title>Low back pain</Title>

          <Type>Text</Type>

          <UpdatedDate>2018-04-05T09:08:40Z</UpdatedDate>

          <Url>https://api.xxx.edu/contentdelivery/v1/api/v1/syndication/getcontent/ABT-20333729?languageCode=en</Url>

     </ContentMetadata>

     <ContentMetadata>

          <ContentId>ABT-20333917</ContentId>

          <LanguageCode>en</LanguageCode>

          <MediaPath i:nil="true"/>

          <Status>Active</Status>

          <Title>Blood in stool</Title>

          <Type>Text</Type>

          <UpdatedDate>2018-04-05T09:08:42Z</UpdatedDate>

          <Url>https://api.xxx.edu/contentdelivery/v1/api/v1/syndication/getcontent/ABT-20333917?languageCode=en</Url>

     </ContentMetadata>

</ArrayOfContentMetadata>

 

 

My XSL looks like this:

 

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

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="xsl">

<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="FileMaker" VERSION="ProAdvanced 12.0v2"/>

      <DATABASE DATEFORMAT="" LAYOUT="" NAME="" RECORDS="" TIMEFORMAT=""/>

      <METADATA>

        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="ContentId" TYPE="TEXT" />

        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="LanguageCode" TYPE="TEXT" />

        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="MediaPath" TYPE="TEXT" />

        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Status" TYPE="TEXT" />

        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Title" TYPE="TEXT" />

        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Type" TYPE="TEXT" />

        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="UpdatedDate" TYPE="TEXT" />

        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Url" TYPE="TEXT" />

</METADATA>

      <RESULTSET FOUND="">

<xsl:for-each select="//ContentMetadata">

          <ROW RECORDID="" MODID="" >

<COL><DATA><xsl:value-of select="ContentId" /></DATA></COL>

<COL><DATA><xsl:value-of select="LanguageCode" /></DATA></COL>

<COL><DATA><xsl:value-of select="MediaPath" /></DATA></COL>

<COL><DATA><xsl:value-of select="Status" /></DATA></COL>

<COL><DATA><xsl:value-of select="Title" /></DATA></COL>

<COL><DATA><xsl:value-of select="Type" /></DATA></COL>

<COL><DATA><xsl:value-of select="UpdatedDate" /></DATA></COL>

<COL><DATA><xsl:value-of select="Url" /></DATA></COL>

          </ROW>

        </xsl:for-each>

</RESULTSET>

    </FMPXMLRESULT>

  </xsl:template>

</xsl:stylesheet>

Outcomes