Custom Formats
Version |
Date |
Changes |
1.0 |
2013-08-05 |
Initial version. |
Description
Using the information in the October 2010 Power Hour on Custom Formats, I have developed two formats of my own, in doing so I ran into a few stumbling blocks. This wiki page may be helpful to someone creating their own custom format.
What version of XSLT is supported?
You must use XSLT 1.0 in your transform authoring. XSLT 2.0+ is not supported. The reason is that ePublisher uses the Microsoft .NET runtime environment for XSL processing. The Microsoft .NET framework only supports XSLT 1.0 (and will only support XSLT 1.0). For more details, see
http://stackoverflow.com/questions/1525299/xpath-and-xslt-2-0-for-net
and
http://blogs.msdn.com/b/xmlteam/archive/2007/11/16/chris-lovett-interview.aspx
XSLT 2.0 is supported for any changes you make to ANT XSL processing, but any files that are in the \Transforms directory require XSLT 1.0
Namespace-qualified elements
You must use namespace-qualified elements in your XSL.
This will not work:
<xsl:template match="Paragraph"> <xsl:apply-templates/> </xsl:template>
What you need was this:
<xsl:template match="wwdoc:Paragraph"> <xsl:apply-templates/> </xsl:template>
You must also namespace-preface wwdoc: Paragraph, TextRun, Text, Marker, Table and others.
I do my debugging in oXygen, and when the elements were not namespace-qualified, I would receive the Saxon error SXXP0005. The solution is the put namespace qualifier in front of every WIF element.
In custom.xsl from the Oct. 2010 Power Hour there are two "root match" templates. One has a mode; one does not.
The root match template that does not have a mode contains a lot of variable setup and other things. It calls the root template with a mode, which is where the much of the processing starts. You will likely need to change things in the unmoded root match template. At that point, write your match templates in one file or across several as you deem necessary.
Seeking additional clarification. This section to be filled out more later.
'Root element is missing' error
If you get an error saying the 'Root element is missing,' the likely cause is that you defined something like: <xsl:output method="text" />. Delete <xsl:output method="text" />. ePublisher writes XML, which is contained in the unmoded root match, in particular everything in between <wwfiles:Files> </wwfiles:Files>. Inside of <wwfiles:Files> is where you define your output method in <xsl:variable name="VarWriteFile" ... />.
Seeking additional information about what valid values can be put in this variable. This section to be filled out more later.
Target Settings & Style Designer
If your custom format is radically different than something already produced by ePublisher, your Target Settings and Style Designer Settings and Options may be completely blank. For the Target Settings, you will need to create your own .fti files (and the XSL files to go with them) to get access to the options you want.
Not sure what would be required to get access into Style Designer Settings & Options. Seeking additional clarification. This section to be filled out more later.