XML データファイル
<?xml version="1.0" encoding="utf-8"?>
<page>
<tab dim="70">
<tab dim="50">
alpha
</tab>
<tab dim="50">
alpha
</tab>
</tab>
<tab dim="30">
gama
</tab>
</page>
XSLT ファイル
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0"
encoding="iso-8859-1" indent="yes"/>
<xsl:template match="/">
<xsl:text disable-output-escaping='yes'><!DOCTYPE html></xsl:text>
<html>
<head>
<title>Title</title>
<link type="text/css" href="/css/framework.css" rel="stylesheet"/>
</head>
<body>
<div id="page-base">
<xsl:for-each select="//tab">
<div class="wrapper tab">
<xsl:attribute name="style">
width:<xsl:value-of select="@dim" />%;
min-width:<xsl:value-of select="@dim" />%;
max-width:<xsl:value-of select="@dim" />%;
</xsl:attribute>
<xsl:value-of select="." />
</div>
</xsl:for-each>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
出力
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
<link rel="stylesheet" href="/css/framework.css" type="text/css">
</head>
<body>
<div id="page-base">
<div class="wrapper tab" style=" width:70%; min-width:70%; max-width:70%; ">
alpha alpha
</div>
<div class="wrapper tab" style=" width:50%; min-width:50%; max-width:50%; "> alpha </div>
<div class="wrapper tab" style=" width:50%; min-width:50%; max-width:50%; "> alpha </div>
<div class="wrapper tab" style=" width:30%; min-width:30%; max-width:30%; "> gama </div>
</div>
</body>
望ましい出力
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
<link rel="stylesheet" href="/css/framework.css" type="text/css">
</head>
<body>
<div id="page-base">
<div class="wrapper tab" style=" width:70%; min-width:70%; max-width:70%; ">
<div class="wrapper tab" style=" width:50%; min-width:50%; max-width:50%; "> alpha </div>
<div class="wrapper tab" style=" width:50%; min-width:50%; max-width:50%; "> alpha </div>
</div>
<div class="wrapper tab" style=" width:30%; min-width:30%; max-width:30%; "> gama </div>
</div>
</body>
</html>