Environment: Elaborate Approach
In this example, the moderate approach is taken a few steps further. More complex scripts are introduced to handle parameters passed between the browser, Web server, and XSL files, enabling a fully dynamic, parameter-driven XML Web site.
How Parameter Passing Works
The elaborate approach adds a parameter-passing layer to the moderate scripts:
URL parameters from the browser — the user's URL request
includes query string parameters (e.g., ?section=overview) that identify
which part of the XML content to display.
Server script reads the parameters — the server-side script captures these parameters and passes them as XSL parameters to the transformation engine, directing which XML nodes to select and how to render them.
XSL uses parameters for conditional output — the XSL
stylesheet uses <xsl:param> and <xsl:if> /
<xsl:choose> logic to produce different HTML output based on the
parameter values received.
This means a single XML file and a single XSL file can serve dozens of distinct pages — with all navigation, section selection, and layout variations handled through parameter passing rather than separate files.
Additional Capabilities
• Multi-level navigation — top-level and second-level page rendering from a single script and stylesheet pair.
• Section highlighting — the active navigation item is highlighted automatically based on the current parameter value.
• Scalability — adding new pages requires only adding new XML content; no new scripts or stylesheets are needed.
Download the complete source code from Inside this Site to see the full implementation for ASP, PHP, JSP, and other environments.