Goh, Swee-Doon (GPMS) wrote:
>
> I have several stylesheets created for my addon and I added css
> references in the {addon}.xxe file. I noticed that the styles are listed
> in alphabetical order. XXE appears to use the first style when opening
> or creating a document. Since I deploy the XXE as an applet along with
> the packaged stylesheets, I suspect it is not possible to use specific
> style for different type of document. I?d like to find it is it
> technically possible to achieve the following through any XXE
> configuration files.
>
>
>
> 1. Load a specific style according to the template I use when
> creating a new file, or loading an existing file?
>
> For example, XXE loads ?style ABC? by default for template
> ?template_001.xml?, and loads ?style XYZ? by default for template
> ?template_003.xml?. These templates are created based on the same schema.
>
I would try this (it works fine in the application and should also work
in the applet):
[1] Add an (standard) xml-stylesheet PI at the top of your document
template. Each PI references a different stylesheet. More info.:
http://www.w3.org/TR/xml-stylesheet
Example:
---
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/css" href="my-addon:custom.css"?>
...
---
Notice that the URI of the CSS stylesheet starts with "my-addon:".
[2] Make sure that option "Ignore <?xml-stylesheet?>" is *not* turned
on. See
http://www.xmlmind.com/xmleditor/_distrib/doc/help/com.xmlmind.guiutil.PreferencesEditorDialog.html#openOptions
[3] custom.css, which is found in your add-on directory, may import
common custom CSS stylesheets:
---
@import "common.css";
para {
background-color: #E0FFE0;
}
---
or even stock CSS stylesheets:
---
@import "xxe-config:docbook/css/docbook.css";
para {
background-color: #E0FFE0;
}
---
[4] You add-on must contain an XML catalog pointing to itself.
Example: my-addon-catalog.xml:
---
<?xml version="1.0" ?>
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"
prefer="public">
<rewriteURI uriStartString="my-addon:" rewritePrefix="." />
</catalog>
---
More info.:
http://www.xmlmind.com/xmleditor/_distrib/doc/configure/addon_types.html