Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved


Chapter 3 Using the XML Interface : XSLT/XPATH Stylesheets

XSLT/XPATH Stylesheets
The default and sample stylesheets included with TIBCO Hawk HTTP Adapter are described in this section, along with tips about customizations.
You can write your own stylesheets to customize or filter the XML stream as needed for your configuration. It is a good idea to study a sample stylesheet before modifying it or creating a new stylesheet.
If a stylesheet takes parameters, you can append those parameters to the relative URL path. If the parameters contain special characters (such as a space), follow the standard encoding rule for URLs. For example, enter the parameter Interface Name as Interface+Name. You can pass a null value.
All stylesheets must be in the HAWK_HOME/webconsole/tomcat/webapps/http/xsl directory. If you reference a stylesheet that is not in this directory, the server returns an error.
AgentState.xsl
Can Be Applied To:
Agents URL
Required Parameters:
This stylesheet creates a tabular format containing all agents in a given state, specified by the AgentState parameter value of 1, 2, 3 or 4. The parameter value is received by the TIBHawkXml servlet and then passed to the XSLT transformation engine.
The following line from the AgentState.xsl file identifies this parameter:
<xsl:param name="AgentState"/>
The following code fragment selects all Agent nodes whose RuleBaseEngineState element has the value specified by the parameter AgentState in the relative URL (text bold for emphasis):
<xsl:apply-templates select="//th:Agents/th:Agent[ $AgentState = th:RuleBaseEngineState]">
</xsl:apply-templates>
For each selected Agent node, the Agent template is instantiated, which formats each row of the table.
Example 1
The following relative URL specifies the AgentState.xsl stylesheet, retrieves all agents across all configured Hawk domains which are in state 4 (high alert), and displays the information in tabular format:
http://localhost:8081/http/Agents?Style=AgentState.xsl&AgentState=4
Example 2
The following relative URL specifies the AgentState.xsl stylesheet, displays all agents across all configured Hawk domains which are in state 3 (medium alert), and displays the information in tabular format:
http://localhost:8081/http/Agent?Style=AgentState.xsl&AgentState=3
AgentAlert.xsl
Can Be Applied To:
Alerts URL
Required Parameter:
Optional Parameter:
This stylesheet retrieves all alerts of a given severity for a given agent. It has one required parameter, AgentName, and one optional parameter, AlertState. If AlertState is not specified, the stylesheet assumes RuleBaseEngine state 4 (high alert).
Example 1
The following example specifies the AgentAlert.xsl stylesheet and retrieves all state 3 (medium) alerts for the agent qaaix03 (text bold for emphasis):
http://localhost:8081/http/Alerts?Style=AgentAlert.xsl&AgentName=qaaix03&AlertState=3
Example 2
The following example specifies the AgentAlert.xsl stylesheet for the agent qaaix03. Because the AlertState parameter is not included in the relative URL, the default alert state of 4 is used and all high alerts are retrieved (text bold for emphasis):
http://localhost:8081/http/Alerts?Style=AgentAlert.xsl&AgentName=qaaix03
ClusterView.xsl
Can Be Applied To:
Agents URL
Required Parameter:
This stylesheet creates a tabular format listing all agents belonging to a given cluster, sorted by RuleBaseEngineState in descending order.
Example
The following relative URL specifies the ClusterView.xsl stylesheet, retrieves all agents in the SOLARIS cluster, and displays the information in tabular format (bold text for emphasis):
http://localhost:8081/http/Agents?Style=ClusterView.xsl&ClusterName=SOLARIS
RuleBaseAlert.xsl
Can Be Applied To:
Alerts URL
Required Parameter:
This stylesheet creates a tabular format listing all alerts resulting from a given rulebase, from all agents in all configured Hawk domains.
Example
The following relative URL specifies the RuleBaseAlert.xsl stylesheet, retrieves all alerts resulting from the AgentLogMonitor-UNIX rulebase in all agents in all configured Hawk domains, and displays the results in tabular format (bold text for emphasis):
http://localhost:8081/http/Alerts?Style=RuleBaseAlert.xsl&Rule=AgentLogMonitor-UNIX
RuleBaseListXml.xsl
Can Be Applied To:
Agents URL
Required Parameter:
This stylesheet provides an example of generating data in a different format. It generates, in XML format, all loaded rulebases in a given agent. The XML data can be used by any XML-aware application.
Example
The following relative URL specifies the RuleBaseList.xsl stylesheet, retrieves all rulebases in the qaisol03 agent, and retrieves the results in XML format (bold text for emphasis):
http://localhost:8081/http/Agents?Style=RuleBaseListXml.xsl&AgentName=qaisol03
Nnames.xsl
Can Be Applied To:
This stylesheet removes the namespace prefix th from all elements and attributes that are namespace qualified with the URI http://www.tibco.com/TIBCOHawk. For more information about namespace, see TIBCO Hawk HTTP Adapter and XML Namespaces.
This stylesheet is useful when working with parsers that are not namespace aware. After you apply this stylesheet to the data, these parsers can process the data.
Alerts.xsl
Can Be Applied To:
Alerts URL
Required Parameters:
This stylesheet creates a tabular format listing all alerts of a given state from all agents within a given domain. The AgentState parameter value can be 1, 2, 3 or 4 to indicate the RuleBaseEngine state of the Hawk Agent.
Example
The following relative URL specifies the Alerts.xsl stylesheet, retrieves all state 3 (medium) alerts from all agents in all configured Hawk domains, and displays the information in tabular format (bold text for emphasis):
http://localhost:8081/http/Alerts?Style=Alerts.xsl&AgentState=3&Domain=default
AddRoot.xsl
Can Be Applied To:
This stylesheet is an example of repackaging data in a different format. It adds a new root element called startscrape and removes the namespace declaration from all elements and attributes that are namespace qualified with the URI http://www.tibco.com/TIBCOHawk. For more information about namespace, see TIBCO Hawk HTTP Adapter and XML Namespaces.
Ident.xsl
Can Be Applied To:
This is the default stylesheet used when the Style parameter is not specified in the relative URL. It displays the XML content without filtering, formatting or transforming the original content, and can be used for debugging.
Result.xsl
Can Be Applied To:
This stylesheet presents method invocation and subscription data in tabular format. It allows you to present the data in any form or format required by an application, such as an HTML application.

Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved