Jump to content
Server Maintenance This Week. ×

exporting text field from FM to xml, so CR and TAB eventually affect formatting in browser


Michael Soth

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

Recommended Posts

  • Newbies

I'm a total newbie, so sorry for asking a dumb question (I have searched and read for a few hours now and whilst my head is buzzing, I'm no further to a solution).

How do I export a text field, containing placeholders for CR and TAB, to XML so that when the xml gets pulled into the browser, they affect the actual formatting, i.e. the show up as indents and

?

I have read up about unicode, stylesheets etc, but I need a simple step-by-step intro.

Thanks so much for devoting time to answering this.

Link to comment
Share on other sites

Browsers display HTML, not XML.

You can use the GetAsCSS() function to convert a text field to a form suitable for displaying in a browser. This will preserve most of the text's formatting, including converting carriage-returns (real ones, not "placeholders", whatever they might be) to

tags.

I don't know of an HTML equivalent for a tab.

What exactly are you hoping to achieve here?

Link to comment
Share on other sites

  • Newbies

Thanks very much for that answer - I'm not sure, though, how to access that function GetAsCSS(). Is that in FileMaker (couldn't find it in version 6)?

What I'm trying to achieve: I maintain a database of courses - people email me formatted blurbs for workshops which I paste into a textfield 'blurb'. I exchange the TAB and CR in the text I receive into placeholders. I would like those blurbs to appear later on the webpage with line breaks and indents, as sent to me.

I used to do the job of constructing the webpage manually, but I have now cottoned onto doing it via XML. Does that make sense ?

The database of courses gets exported to InDesign for a printed brochure, and it gets exported also for the web. If I could just export it to XML, the webpage showing all our courses would be so much easier to build and maintain.

Thanks a lot for any further help.

Michael

Link to comment
Share on other sites

GetAsCss came in 7. Just as a FYI, you may want to state your version of FileMaker in your post next time. You can also add it to your account settings. I is under 'FileMaker Questions'.

BTW Welcome to the forums.

Link to comment
Share on other sites

I just saw raybaudi's post and noticed that the FileMaker Pro versions in one's profile are not displaying properly so if you already done this then you can ignore my last post regarding the version. :

Link to comment
Share on other sites

Filemaker, incl. version 6, can export records as XML. If, as it seems, you have some kind of web publishing template that can accept XML data, that would be the best route to take. During the export, you can use a XSLT style sheet to transform the exported data from Filemaker's XML schema into the desired XML schema (or directly to HTML or a text format). The style sheet needs to be custom-tailored to both the input and the output, so it's not possible to give a general step-by-step guidance. A few examples of XSLT style sheets are included with the application, and you could use one of them as a starting point.

XSLT is not easy to learn, so if you intend to do this yourself, be prepared to devote some time to it.

Link to comment
Share on other sites

  • Newbies

Thanks for that - that's what my previous reading led me to conclude: that I need to use XSLT to transform in put and output, and that it needs proper delving into and learning. So, no shortcuts, then ?

The only transformation of the text I need at this point is to replace any TABs or CR occurring within the text field into a form that will not disrupt the XML file and can be translated into text-indents and line breaks in the browser. If anybody does have a shortcut that would save me the learning curve of XSLT, that would be great ....

Thanks again for everybody's help.

Link to comment
Share on other sites

I still don't understand what you're saying here:

replace any TABs or CR occurring within the text field into a form that will not disrupt the XML file and can be translated into text-indents and line breaks in the browser.

When you export as XML, tabs and carriage-returns within fields are preserved. This does not "disrupt" the XML file in any way. However, as I said, browsers do NOT display raw XML. Usually, you would transform XML into HTML to display it in a browser. That can be done with a style sheet, though again, I don't know what would be the proper equivalent of a tab in HTML.

Link to comment
Share on other sites

This topic is 5711 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.