Jump to content

XML/XSTL Trouble


This topic is 2265 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi,

I am having trouble with writing a style sheet, when I run my script that call for the import I get a error code 719 which is the "Unable to Translate" ??

Anyway ...

Here is my xml link;

http://www.floatrates.com/daily/usd.xml

Here is my style sheet

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<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="01-11-2012" NAME="FileMaker" VERSION="ProAdvanced 12.0v1"/>
<DATABASE DATEFORMAT="M/d/yyyy" LAYOUT="" NAME="GraphicsPro.fmp12" RECORDS="1" TIMEFORMAT="h:mm:ss a"/>

<METADATA>
<FIELD NAME="XML Currency Description" TYPE="Text"/>
<FIELD NAME="XML DateTime Stamp" TYPE="Timestamp"/>
<FIELD NAME="XML Currency Code” TYPE="Text"/>
<FIELD NAME="XML Currency Rate” TYPE="NUMBER"/>
</METADATA>

<RESULTSET>

<ROW>
<COL>
<DATA><xsl:value-of select=“channel/item[9]/title”/></DATA>
</COL>
<COL>
<DATA><xsl:value-of select=“channel/item[9]/pubDate”/></DATA>
</COL>
<COL>
<DATA><xsl:value-of select=“channel/item[9]/targetCurrency”/></DATA>
</COL>
<COL>
<DATA><xsl:value-of select=“channel/item[9]/exchangeRate”/></DATA>
</COL>
</ROW>

</RESULTSET>
</FMPXMLRESULT>

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

 

Any assistance in this matter I would be grateful.

Thank you.

Mr. Ignoramus

GraphicsProCurrency.txt

Link to comment
Share on other sites

Or if you'd like to do them all in one go

---

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

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

<xsl:output method='xml' version='1.0' encoding='iso-8859-1' indent='yes'/>

<xsl:template match="/*">

  <FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">

  <ERRORCODE></ERRORCODE>

  <PRODUCT BUILD="" NAME="" VERSION=""/>

  <DATABASE DATEFORMAT="M/d/yyyy" LAYOUT="" NAME="" RECORDS="{count(/channel/item)}" TIMEFORMAT="h:mm:ss a"/>

  <METADATA>

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

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

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

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

    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="rate" TYPE="NUMBER"/>

  </METADATA>

  <RESULTSET FOUND="{count(/channel/item)}">

    <xsl:apply-templates select="/channel/item"/>

  </RESULTSET>

</FMPXMLRESULT>

</xsl:template>

<xsl:template match="*[name() = 'item']">

<ROW xmlns="http://www.filemaker.com/fmpxmlresult" MODID="0" RECORDID="{position()}">

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

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

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

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

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

</ROW>

</xsl:template>

</xsl:stylesheet>

---

Outputs based on: xsltproc /Applications/FileMaker\ Pro\ 11\ Advanced/English\ Extras/Examples/XML\ Examples/Import/floatrates2fmpxmlresult.xslt http://www.floatrates.com/daily/usd.xml

---

<?xml version="1.0" encoding="iso-8859-1"?>

<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">

  <ERRORCODE></ERRORCODE>

  <PRODUCT BUILD="" NAME="" VERSION=""/>

  <DATABASE DATEFORMAT="M/d/yyyy" LAYOUT="" NAME="" RECORDS="92" TIMEFORMAT="h:mm:ss a"/>

  <METADATA>

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

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

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

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

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

  </METADATA>

  <RESULTSET FOUND="92">

    <ROW MODID="0" RECORDID="1">

      <COL>

        <DATA>1 USD = 0.88686408 EUR</DATA>

      </COL>

      <COL>

        <DATA>Sun, 17 Apr 2016 00:00:01 GMT</DATA>

      </COL>

      <COL>

        <DATA>USD</DATA>

      </COL>

      <COL>

        <DATA>EUR</DATA>

      </COL>

      <COL>

        <DATA>0.88686408</DATA>

      </COL>

    </ROW>

    <ROW MODID="0" RECORDID="2">

      <COL>

        <DATA>1 USD = 0.70550060 GBP</DATA>

      </COL>

      <COL>

        <DATA>Sun, 17 Apr 2016 00:00:01 GMT</DATA>

      </COL>

      <COL>

        <DATA>USD</DATA>

      </COL>

      <COL>

        <DATA>GBP</DATA>

 

.

 

.

 

.

 

      <COL>

        <DATA>6.86000000</DATA>

      </COL>

    </ROW>

    <ROW MODID="0" RECORDID="92">

      <COL>

        <DATA>1 USD = 0.38450000 OMR</DATA>

      </COL>

      <COL>

        <DATA>Sun, 17 Apr 2016 00:00:01 GMT</DATA>

      </COL>

      <COL>

        <DATA>USD</DATA>

      </COL>

      <COL>

        <DATA>OMR</DATA>

      </COL>

      <COL>

        <DATA>0.38450000</DATA>

      </COL>

    </ROW>

  </RESULTSET>

</FMPXMLRESULT>

Edited by ggt667
tested with example output
Link to comment
Share on other sites

This topic is 2265 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.