DITA Storm Reference

XSL Support

Developer supports WYSIWYG editing, allowing XML documents to be edited as if they were already processed by XSL transformation. To optimize performance and user experience on the browser end, XSL templates need to be compiled before they are provided to Developer. The simple compilation process involves the execution of a command line script written in Java.

XSL Element Support

Currently Developer supports the following XSL elements and attributes:

Element/Attribute Notes
<xsl:stylesheet>
  ...
</xsl:styleheet>
<xsl:template name='...' match='...'>
  ...
</xsl:template>
See XPath Support section for details.
<xsl:apply-templates select='...'/>
See XPath Support section for details.
<xsl:value-of select='...'/>
See XPath Support section for details.
<xsl:choose>
  ...
</xsl:choose>
<xsl:when test='...'>
  ...
</xsl:when>
See XPath Support section for details.
<xsl:otherwise>
  ...
</xsl:otherwise>
<xsl:if test='...'>
  ...
</xsl:if>
See XPath Support section for details.
<xsl:call-template name='...'/>
<xsl:attribute name='...'>
  ...
</xsl:attribute>

XPath Support

Currently Developer supports the following XPath elements:

XPath Element Notes
/.. match from root node
.../... match child nodes/elements
ncname matchtag with specified name
ncname[...] match tag or node according to specified condition
.. parent node
(...) bracket grouping
number numbers
@ncname attributes
‘literal’ strings
position() 1-based position index
name() name of the element
$editing At this time Developer only supports ‘editing’ variable and is always set to 'true' in the context of the editor. It can be used to differentiate between normal and Developer rendering when the same XSL transformation is being used for both.
... = ... equals operator
... != ... not-equals operator
... | ... union operator on set of nodes
... and ... boolean ‘and’ operator
... or ... boolean ‘or’ operator

There are three input files that define the presentation and functionality of the XML within Developer:

  • model.xml - definition of XML structure with supporting information
  • XSL stylesheet - stylesheet defines exact rendering of the XML
  • CSS stylesheet - styling used in the editing area

To optimize performance and improve user experience, XSL templates and the XML structure definition file (model.xml) need to be compiled into a corresponding JavaScript resource file.

XSL and XML compiled into JavaScript resource files

Output of the compilation process is to be placed into the editor ‘config’ directory, replacing existing files.

They can now be consumed by Developer:

Resource files available to Developer

The simple compilation process involves executing the command line script written in Java. Sample usage of the script:

compile -model model.xml -xsl my_style.xsl

To compile the original model.xml and simple.xsl provided with the editor:

compile -model ../DITAStorm/config/model.xml \ -xsl ../DITAStorm/config/simple.xsl \
-modeljs ../DITAStorm/config/model.js \ -xsljs ../DITAStorm/config/simple.xsl.js

The command above will replace two files: model.js and simple.xsl.js in the original Developer configuration directory.

If for some reason the compilation script can not find java executable automatically, please set the JAVA_HOME environment variable to point to the appropriate location.