<table>
<tr>
<th>name:</th>
<td>
<xsl:value-of select="attribute::name"/>
</td>
</tr>
<tr>
<th>phone:</th>
<td><xsl:value of select="attribute::phone"/></td>
</tr>
</table>
</td>
</xsl:template>
</xsl:stylesheet>
Пример 14.20. Применение таблицы стилей animals.xsl для файла animals.xml с использованием библиотеки Xalan
#include <exception>
#include <iostream> // cout
#include <xalanc/Include/PlatformDefinitions.hpp>
#include <xalanc/XalanTransformer/XalanTransformer.hpp>
#include <xalanc/XSLT/XSLTInputSource.hpp>
#include <xalanc/XSLT/XSLTResultTarget.hpp>
#include <xercesc/util/PlatformUtils.hpp>
#include "xerces_strings.hpp" // Пример 14.4
using namespace std;
using namespace xercesc;
using namespace xalanc;
// Утилита RAII, которая инициализирует парсер и освобождает ресурсы
// при выходе из области видимости
struct XalanInitializer {