HP Matrix Operating Environment Chargeback
Technical white paper | HP Matrix Operating Environment Chargeback 
13 
XSLT Element 
Description 
<xsl:value-of> 
Extracts the value of a specified node. 
The following example gets data of the specified node: 
<xsl:value-of 
select="GetServiceUsageDetail/ServiceUsageDetail/serviceInformation/
name"/> 
The select attribute contains an XPath expression that specifies which node to extract the value. 
<xsl:variable> 
Declares a variable. 
The following example gets data of the specified node and stores in a variable named fixedCost: 
<xsl:variable name="fixedCost" 
select="resourceUsageSummary/fixedCost"/> 
The select attribute contains an XPath expression that specifies which node value should be stored in 
the variable. 
<xsl:if> 
Add the content of the <xsl:if> element if a test condition is true. 
The following example checks if a condition is true <xsl:if test="price > 10"> 
The next sections show the use of XSL to format chargeback XML data in Figure 4. To generate the report, the source XML 
file should include a reference to the XSL transformation file as shown in the “Applying the formatter to the source data” 
section. 
Creating a sample formatter 
The following example shows a very simple report containing formatted text. As mentioned previously, the reports are 
created in HTML through the use of XSL transformations; therefore, it is possible to use every available tag in HTML to 
format the resulting report. Note that this initial report does not include any allocation data metrics; it only demonstrates 
the use of basic HTML formatting tags. 
Note 
Formatter files used in this paper can be downloaded from the Toolkits/Samples tab at: 
http://www.hp.com/go/csdevelopers 
or  
http://h21007.www2.hp.com/portal/StaticDownload?attachment_ciid=9eab36816eb68310VgnVCM200000a460ea10RCRD 
Figure 15. XSLT presenting formatted text 
<?xml version="1.0" encoding="UTF-8"?> 
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> 
 <xsl:output method="html"/> 
 <xsl:template match="/"> 
 <html> 
 <body> 
 <h2><u>Report</u></h2> 
 <font color='red'><h3><i>No data available</i></h3></font> 
 </body> 
 </html> 
</xsl:template> 
Following is an example of how Excel displays the source XML data when the preceding XSL is applied. For more details 
about how to prepare the source XML file to use the XSL and how to open the file in Excel, see “Applying the formatter to the 
source data.” 










