<?xml-stylesheet type="text/xsl" href="/style/testcase.xsl"?>
<t:test xmlns:t="http://xproc.org/ns/testsuite"
        xmlns:p="http://www.w3.org/ns/xproc"
        xmlns:c="http://www.w3.org/ns/xproc-step"
        xmlns:err="http://www.w3.org/ns/xproc-error">

<t:title>Test add attribute 003</t:title>

<t:input port='source'>
<html>
<head>
<title>Testing Add Attribute</title>
</head>
<body>
<h1>Testing Add Attribute</h1>
<div class="wrongclass" style="background: red;">
<p>This is the first div</p>
<div>
<p>This is a nested div</p>
</div>
</div>
<div>
<p>This is the second div</p>
</div>
</body>
</html>
</t:input>

<t:pipeline>
<p:pipeline version='1.0' name="main" xmlns:p="http://www.w3.org/ns/xproc">
  <p:add-attribute match="body/div"
		   attribute-name="class"
		   attribute-value="chapter"/>
</p:pipeline>
</t:pipeline>

<t:output port='result'>
<html>
<head>
<title>Testing Add Attribute</title>
</head>
<body>
<h1>Testing Add Attribute</h1>
<div style="background: red;" class='chapter'>
<p>This is the first div</p>
<div>
<p>This is a nested div</p>
</div>
</div>
<div class="chapter">
<p>This is the second div</p>
</div>
</body>
</html>
</t:output>

</t:test>

