Introducing XWeb

Typical XPath expressions

This is a list of XPath expressions as they are typically used for creating a layout stylesheet for XWeb. All given expressions assume that the expressions won't produce conflicts with other (non-XWeb) elements, which should be fine with XHTML input. If you use other XML input you might want to add "/path/to/navigationElement" in front of these expressions, in the XHTML case it would be e.g. "/html//entry[@active='true']/@name" for the name of the active page instead of just "//entry[@active='true']/@name".

Creating the navigation

@active = 'true'
Test if we process an active section or the active entry. There can be multiple active sections if sections are nested.
entry[1]
Returns the first entry when processing a section. Useful if you want to link the section buttons.
//section[@active='true']/entry
Finds all entries of active sections. Usually you will have only one active section with entries.
position() = 1
Tests if the current element in the first in a set (avoid using * with this, it will include the text nodes into the set, inluding whitespace). Useful e.g. to give the first button in a section a different look.
position() = last()
Tests if the current element in the first in a set (avoid using * with this, it will include the text nodes into the set, inluding whitespace). Useful e.g. to give the first button in a section a different look.

Finding images

//section[@active='true']/img[@xwebtype='sectionBanner']
The banner for the active section (assuming the image style is called "sectionBanner").
//entry[@active='true']/img[@xwebtype='entryBanner']
The banner for the active page (assuming the image style is called "entryBanner").
//img[starts-with(@xwebtype, 'mouseOver')]
Finds any image for which the type of the image style starts with teh string "mouseOver". This is useful for preloading images.
//file[@id='someID']/@src
Returns the url for the result of a <file> entry with the given ID -- useful to add special images that are just copied into the output.

Cross-references

//entry[@id='someID']/@src
Returns the url for a page created by an <entry> with the given ID.
//file[@id='someID']/@src
Returns the url for the result of a <file> entry with the given ID.