K1200 Posted January 23, 2009 Posted January 23, 2009 In one of Fenton's posts regarding exporting text using an XML style sheet, he said: ... this does not solve the basic problem of what to put in between the fields, and what between the records. If you do not specify anything, xsl will just mush it all together ... I've now come upon a case where "mush is all together" is exactly what I need -- but I don't know style sheets at all. I've attached the one I'm currently using. Can someone give me a tip on how to modify it so that nothing is added between exported text fields. I need the resulting file to be one long text string. Thanks in advance for any help. XMLstyle.txt
Fenton Posted January 23, 2009 Posted January 23, 2009 OK, you want "mush"? Simply remove all the separators. The following will add nothing, between fields or between records. The output is ASCII text. You could put otherwise, ie., utf-8 (like the stylesheet itself). <?xml version="1.0" encoding="utf-8"?> xmlns:fm="http://www.filemaker.com/fmpxmlresult" exclude-result-prefixes="fm" >
K1200 Posted January 24, 2009 Author Posted January 24, 2009 Thanks, Fenton. That did the job. But, I am curious about one thing. Why is a reference to FileMaker's website needed in the stylesheet? xmlns:fm="http://www.filemaker.com/fmpxmlresult" exclude-result-prefixes="fm" > I wasn't able to spot any meaningful (to me) explanation on XML tutorial sites.
Fenton Posted January 24, 2009 Posted January 24, 2009 "xmlns" means xml "namespace". It is a way to assert ownership over and identify "your" xml elements. Since anyone can create pretty much anything (which follows the few rules) as an xml element, namespaces were conceived as way to positively identify yours. It really only would come to play in cases where there were duplicate hence conflicting element names; which would be rare, but is possible. Just look at FileMaker's elements, , , . You can see how someone else might use the same in an xml document. Or, the usual example, a furniture supplier's In any case, FileMaker includes its namespace in its exported xml: So, you must include it in your xsl stylesheet declaration. You then define some abbreviation to use to identify the elements; this can be anything, but we commonly use "fm" or "fmp". Then you add the option, exclude-result-prefixes="fm", in order to remove them from the output, since no one else wants them. Yeah, it's kind of confusing. There's more to it I suppose, but that's what I know :-]
K1200 Posted January 25, 2009 Author Posted January 25, 2009 An excellent explanation. Thanks very much.
Recommended Posts
This topic is 5781 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