Skip to content

Creating custom XSL stylesheets

richard-srnsw edited this page · 34 revisions

Example: a batch file that automatically create directory structures

<xsl:stylesheet xmlns:xsl="" xmlns:rda="" version="1.0">
  <xsl:template match="/">
<xsl:stylesheet xmlns:xsl="" xmlns:rda="" version="1.0">
<xsl:output method="text" encoding="UTF-8"/>
<xsl:include href="include/utils.xsl"/>
<xsl:template match="/">
<xsl:apply-templates select="//rda:Term"/>
<xsl:template match="rda:Term">
<!-- the "%~dp0" creates the new directories in the directory where the batch file sits. If running the batch file over a network, using a user's current working directory might be more appropriate. To do this, change line to: <xsl:text>mkdir "%cd%\</xsl:text>-->
<xsl:text>mkdir "%~dp0\</xsl:text>
<!-- use the "build_address" template in the "utils.xsl" stylesheet bundled with XML Authority Editor. This template is used in many AE stylesheets to create breadcrumb-style names i.e. "Function Title - Activity title". We use it here to build a directory structure i.e. "Function Title\Activity Title".-->
<xsl:call-template name="build_address">
<xsl:with-param name="node" select="."/>
<xsl:with-param name="sep" select="'\'"/>

Adding your XSL stylesheet to Authority Editor

It is easy to add new XSL stylesheets to Authority Editor.

The first step is to copy your new stylesheet into the program's stylesheet directory: ‘[install location]\lib\ruby\site_ruby\1.8\ae\data\stylesheets'.

The program’s ‘transform’ menu is built dynamically whenever the program is loaded from a manifest file in the stylesheets directory: ‘...\stylesheets\xsl_manifest.xml’. After copying your new stylesheet over, add it as an entry in the manifest file.

To add your new stylesheet to the manifest file, simply determine what type of stylesheet it is and add it as a ‘stylesheet’ element to the appropriate part of the manifest file. The ‘transform’ menu accommodates four distinct types of stylesheet: edit (the output from the transform replaces the currently selected XML document), preview (the output will open in Internet Explorer), word (the output will open in MS Word) and export (the output is opened as a new tab within the program – use this as a fallback as it can accommodate basically any type of output including text, xml, html, csv, tsv, etc.).

All ‘stylesheet’ elements should contain at least two sub-elements: ‘text’ (the menu text) and ‘file’ (the file name). If it is an export stylesheet, you must also include an ‘extension’ element (e.g. csv, tsv, xml, txt).

Return home

Something went wrong with that request. Please try again.