Home › Forums › General XMetaL Discussion › Different stylesheet for ‘Tags On’ and ‘Normal’ view? › Reply To: Different stylesheet for ‘Tags On’ and ‘Normal’ view?
Reply to: Different stylesheet for ‘Tags On’ and ‘Normal’ view?January 9, 2012 at 6:53 pm
Yes you can modify the XSLT. If an XSLT file is not already present (first time you switch to Page Preview) one is auto-generated based on the currently loaded CSS file. However, once a file is present then it should be used and not generated again. So, provided you use the correct file name you can write your own. It is likely easiest to allow the file to auto-generate and then modify the generated file.
When files are auto-generated they end up in your %appdata%SoftQuad folder. Look for XSLT files that have similar names to the CSS file associated with your schema here (which is typically the same as your schema file name):
Also, have a look at the documentation in the Programmers Guide for “Formatting Object interface” as it contains useful information. You can add functionality that lets the user generate HTML or PDF for both previewing or saving using this interface (previewing is basically the same as saving with the addition of either opening the file in Page Preview or an external viewer). The Journalist sample customization implements the following functions (that use the Formatting Object interface) on the Journalist toolbar: Save as HTML, View HTML, Save as PDF, View PDF. PDF uses Apache FOP. The Journalist sample remembers the last of the two functions you chose (View HTML and View PDF) so that in future you simply need to switch to Page Preview to see that format again.
An alternative is to disable multipleOutput.mcr completely (by giving it a different file extension so it does not load or by removing it) and then referencing an XSLT style-sheet directly inside your XML document. In this case, when you switch to Page Preview, Internet Explorer will transform the document directly using the referenced XSLT file (the same as it will do if you open that file directly within an externally running copy of IE).
Note: that none of the above applies to DITA documents. When working with DITA documents an entirely different process is used to generate documents for Page Preview that uses the DITA OT.