Article View: adobe.framemaker.sgml
Article #135Re: Translate special characters at XML save/load
From: Trevor_Nicholls
Date: Thu, 19 Feb 2009 05:20
Date: Thu, 19 Feb 2009 05:20
32 lines
1950 bytes
1950 bytes
Thanks Van, it's a bit more complex than this and no, I don't have elements for the non breaking characters; I have elements containing particular types of data (like versions, filenames, and so on) which I do not want to break.
I do not want to put special non-breaking characters into the XML text - the break policy is dependent on the element type and having to control it at the lowest text level is anathema. However I have been able to solve the problem in two XML stylesheets and I'll provide the solution here in case it is useful to anyone else:
In the xml2fm stylesheet (losing some punctuation so as not to upset this forum's HTML):
xsl:template match="version | filename" xsl:copy
xsl:value-of select="translate(translate(.,' ',' '),'-','‑')"
/
/xsl:copy
/xsl:template
And the converse in the fm2xml stylesheet:
xsl:template match="version | filename" xsl:copy
xsl:value-of select="translate(translate(.,' ',' '),'‑','-')"
/
/xsl:copy
/xsl:template
This is only OK because the elements listed (and others that I haven't included in the example) have a simple text content model. Any elements with more complex content would require a bit more work, but the same principle would work.
Thanks
T
Technical Details
Message-ID:
<59b7f90b.1@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!newshub.sdsu.edu!webcrossingReferences:
<59b7f90b.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: fcc08,5fa4972d79faa349 X-Google-Attributes: gidfcc08,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: Trevor_Nicholls@adobeforums.com Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!newshub.sdsu.edu!webcrossing Newsgroups: adobe.framemaker.sgml Subject: Re: Translate special characters at XML save/load Message-ID: <59b7f90b.1@webcrossing.la2eafNXanI> Date: Wed, 18 Feb 2009 21:20:25 -0800 References: <59b7f90b.-1@webcrossing.la2eafNXanI> Lines: 37 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit