XSLT transformation doesn't work for preview
Posted by Péter Botta on 26 March 2013 02:46 PM
Title: XSLT transformation doesn't work for preview
Context: You are creating an XML filter configuration, and want ot have a nicely formatted HTML preview for it, in place of the "code preview" you normally get. You have an XSLT file or a folder with XSLT and related files, you set up the main XSLT file. Preview creation still fails. In web browsers, the same XML file is displayed fine with the same XSLT.
Description: The XSLT file probably referers to other external XSLT (or DTD) files. memoQ needs to collect all these files and save them in the XML filter configuration. memoQ does make an attempt at this, but its capabilities are limited. There are two known cases that cause a failure.
1. One is when there is a reference to external files that are "above" the main file in the folder structure. For example, the main XSLT file is c:\work\xslt\main\main.xsl, and it refers to c:\work\xslt\other_files\another.xsl. Then the reference looks something like this:
<xsl:import href="../other_files/another.xsl" />
<xsl:include href="../other_files/another.xsl" />
(The ../ part means "one directory up".)
2. The other known issue is when the reference to an external file is assembled (concatenated) from parts using the concat function, for example:
<xsl:value-of select="concat('genstrings_', $language,'_',$variant, '.xml')" />
At this point, memoQ cannot parse the XSLT files to understand these parts.
<xsl:import href="other_files/another.xsl" />
For the concatenated refrences, there is no other simple solution then to aviod them, and use direct references instead. Or you can take a look at the memoQ log file, where you will see an error message that tells you where the system was looking for what exact file. You can look up that file and place it to the location memoQ is asking for. This will either solve the problem, or you will get another similar error with another file, and you will need to do the same, and so on.