Jump to content
Sign in to follow this  
K1200

Need style sheet tune up

Recommended Posts

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

Share this post


Link to post
Share on other sites

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" >

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

"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 :-]

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

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