Jalz Posted December 24, 2005 Posted December 24, 2005 Hi Guys, I've been trying to get to grips with XML, by downloading the various examples from XML Central and reading the guide FMP 6 Developer Guide to XML/XSL by Beverly Voth. Im stuck on a very small thing, which any one with real xml experience will find very easy to answer. Ive got my code listed below: Im exporting fields A through to Z, where the Z field (position() 26) contains a colour value. The data might say Yellow, Red, White etc. My question is, how do I alter my line 3 to check the value of the field and call the necessary coloured variable. I have created variables underneath my stylesheet which I would like to call from the above code, ill just give yellow as an example: #FFFF99 Any help will be much appreciated Many Thanks
Martin Brändle Posted December 26, 2005 Posted December 26, 2005 Instead of using long lists of variable definitions and or statements, it's better to use an external translation table where the individual translation color --> hex RGB value can be looked up with an XPath. You gain a lot of flexibility, and the code is very short and efficient. See the attached example how this works. colors.zip
Jalz Posted December 26, 2005 Author Posted December 26, 2005 Thankyou very much Martin, Your example helped me in more ways than you think. Its further enhanced the my limited knowledge of stylesheets and how they are constructed... One thing I dont quite understand - (and Im only a beginner - only spent around 28 hours, reading and doing examples), when I define a variable I use a . In your example you dont....the code works, but why do . Can you recommend any further "basic" books I can increase my knowledge on this subject with the use of FileMaker - especially with MSOFFICE. Many thanks once again Jalz
Martin Brändle Posted December 26, 2005 Posted December 26, 2005 Whenever an XML tag has no child elements, e.g. , you can abbreviate it as . See the W3C recommendation for XML, section empty tags. With respect to MS-Office I have no clue. Best probably is to visit Microsoft XML Developer Center. The book "XSLT : Programmer's Reference" by Michael Kay, Wiley Publishing, 2003, ISBN 0-7645-4381-4 is a MUST HAVE.
Jalz Posted December 27, 2005 Author Posted December 27, 2005 Hi Martin, I've been developing the example you gave me and I've finally achieved the result I wanted (in html format). I need to export data from another TO, and Im fairly confident that I can create a stylesheet to get that to present in the format I'd like. Is it possible, when I do the second export, to "merge" the results of the first xlst result?
Martin Brändle Posted December 27, 2005 Posted December 27, 2005 Yes, export the first TO as XML (or transform it to another XML format, also possible). When exporting the second TO, use a stylesheet that loads the first XML TO with the document() function. Then you can transform both XML trees and merge them.
Recommended Posts
This topic is 6904 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 accountSign in
Already have an account? Sign in here.
Sign In Now