About xsl – Apple Mac OS X Server (Extending Your Wiki Server For Version 10.5 Leopard) User Manual

Page 27

Advertising
background image

Chapter 1

Customizing How the Wiki Looks

27

JavaScript Example

The following example JavaScript function adds a header link next to the magnifier
button that points to www.apple.com, and changes the “Other Wikis” link to point to
www.apple.com:

Event.observe(window, 'load', function() {
// add another header link (to apple.com) by manipulating the DOM
// using script.aculo.us Builder
// we'll just insert it before the search button
if ($('linkSearch')) {
$('linkSearch').parentNode.insertBefore(Builder.node('li',

{id:'linkApple'}, [

Builder.node('a', {href:'http://www.apple.com'}, 'apple')
]), $('linkSearch'));
}
// change the Other Wikis link to something else
if ($('groups_users_button')) {
$('groups_users_button').down('a').href = 'http://www.apple.

com/';

}
});

To use this example JavaScript code, save it as a .js file in this folder:
/Library/Application Support/Apple/WikiServer/Themes/theme_name/

About XSL

XSL defines XML document transformation and presentation. For information about
XSL, see:

www.w3.org/Style/XSL/

The wiki server uses a set of XSL files located at:
/usr/share/wikid/lib/apple_templates/

Because a software update can overwrite files in /usr/share/wikid/lib/
apple_templates/, edit the copies of these XSL files located in:

/Library/Application Support/Apple/WikiServer/Themes/theme_name/

XSL files in this location override XSL files in /usr/share/wikid/lib/apple_templates/.

If a software update overwrites the files in /usr/share/wikid/lib/apple_templates/, you’ll
need to manually merge the changed contents of your customized XSL files with the
updated XSL files. If you don’t merge the contents, the versions won’t match and an
error will occur.

Advertising