XSLT transformation doesn't work for preview
Context: You are creating an XML filter configuration, and want to 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 refers 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.
Fix: For external files above the You can rearrange the external files and folders so that all references point to the same folder or subfolders of the location where the main XSLT file is. Following the above example, you would need to move the "other_files" folder "under" c:\work\xslt\main, and change the reference in the main XSLT file like this:
<xsl:import href="other_files/another.xsl" />
For the concatenated references, there is no other simple solution then to avoid 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.