Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

Hi,

I am totally new in xslt.  I have the following xslt and I tried to export as xml.   I got an error.    "SAXParseException: invalid document structure".  Is there a problem in my structure?  What's the proper structure?

 

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

<xsl:stylesheet version='1.0'

  xmlns:xsl='http://www.w3.org/1999/XSL/Transform'

  xmlns:fm="http://www.filemaker.com/fmpdsoresult"

  exclude-result-prefixes="fm">

      <xsl:output version='1.0' encoding='UTF-8' indent='yes'

        method='xml' />

      <xsl:template match="/">

      <cityforcast>

            <xsl:for-each select="fm:FMPDSORESULT/fm:ROW">

                  <forcast>

                        <id><xsl:value-of select="./fm:ID” /></id>                       

                        <city><xsl:value-of select="./fm:City” /></city>

                        <temperature><xsl:value-of select="./fm:Temperature” /></temperature>

                        <humidity><xsl:value-of select="./fm:Humidity” /></humidity>

<windspeed><xsl:value-of select="./fm:Wind Speed” /></windspeed>

                        <winddirection><xsl:value-of select="./fm:Wind Direction” /></winddirection>

                        <clouds><xsl:value-of select="./fm:Clouds” /></clouds>

                  </forcast>

            </xsl:for-each>

      </cityforcast>

      </xsl:template>

</xsl:stylesheet>

Weather.fmp12

Posted

I see two problems here:

1. Your stylesheet uses the right quotation mark character (a.k.a. a "smart" or "curly" quote) where a regular quotation mark is required; for example in line 23, after "fm:ID":

<id><xsl:value-of select="./fm:ID” /></id>

and in 6 more places.

Lesson: use a text editor, not a word processor, to create and edit XML/XSLT documents.

 

2. Two of your fields have spaces in their names. This is allowed (though not recommended) in Filemaker, but when you export as XML using the FMPDSORESULT  grammar, Filemaker will replace the spaces with underscore characters because XML element names cannot contain spaces and the expression:

<xsl:value-of select="./fm:Wind Speed” />

is invalid XSLT syntax. It will work if you change it to:

<xsl:value-of select="./fm:Wind_Speed" />

This is one of the reasons why the FMPXMLRESULT grammar is preferable; you do not depend on your field names - most importantly, you can rename your fields without affecting your stylesheet. 

 

This topic is 2001 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
×
×
  • Create New...

Important Information

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