jonr Posted April 17, 2003 Posted April 17, 2003 I'm exporting to an xml file using an xsl stylesheet. The fmp file has fields "alpha" and "beta" (I'm simplifying this down to its essentials). The contents of these fields are respectively "one" and "two". Here's what I want in the output document: one two I've tried various methods to achieve this. However, if I use the standard technique: <xsl:value-of select="fmp:alpha"/><xsl:text> </xsl:text><xsl:value-of select="fmp:beta"/> I get: one two (Actually, it's "one" followed by 0D0D0A; i.e. there's an extra carriage return.) I've tried just about everything else I could think of, such as: <xsl:value-of select="fmp:alpha"/>
<xsl:value-of select="fmp:beta"/> But the character reference is completely ignored: onetwo I realize that xsl provides limited control over whitespace, but this business of an extra return is pretty odd. The FMP doc says it uses Xalan to process xsl, but when I try the first method in Xalan-Java 2.4.1 directly (on a file exported from FMP without applying a stylesheet), it works. Is there some way to obtain the actual Xalan behavior, or a workaround?
cjaeger Posted April 18, 2003 Posted April 18, 2003 ever tried xsl:preserve-space ? see XML examples folder, or http://www.w3schools.com/xsl/el_preserve-space.asp
jonr Posted April 18, 2003 Author Posted April 18, 2003 Thanks, but xsl:preserve-space is no help here. As your link states: "Preserving white space is the default setting, so using the <xsl:preserve-space> element is only necessary if the <xsl:strip-space> element is used."
cjaeger Posted April 19, 2003 Posted April 19, 2003 OK, the do a strip-space. And enable preserve-space only for the elements where you need them or check the line breaks in your xsl file (CRLF,just CR, just LF?). They should correspond to your platform. (win,mac,unix). Maybe you have copied something from a web page or a file that originated fro anorther platform. Use "show invisibles" in your texteditor to check.
jonr Posted April 22, 2003 Author Posted April 22, 2003 The line breaks in my xsl are normal for Windows. As I mentioned, Xalan itself behaves normally - it is only when I export from FileMaker that I get the extra CR in the output. xsl:preserve-space and xsl:strip-space apply to whitespace-only nodes in the input, which are irrelevant in this case. I did try adding xml:space="preserve", but still get CR CR LF where I should get CR LF. This appears to be a bug in FileMaker's xsl processing. If you create a FMP file with fields "alpha" and "beta" and export to FMPDSORESULT applying the stylesheet below, I believe you'll get the same results. <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fmp="http://www.filemaker.com/fmpdsoresult"> <xsl:output method="xml" version="1.0"/> <xsl:template match="/"> <xsl:apply-templates select="fmp:FMPDSORESULT/fmp:ROW"/> </xsl:template> <xsl:template match="fmp:FMPDSORESULT/fmp:ROW"> <foo xml:space="preserve"> <xsl:value-of select="fmp:alpha"/> <xsl:value-of select="fmp:beta"/> </foo> </xsl:template> </xsl:stylesheet>
Recommended Posts
This topic is 7886 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