Add-attribute-027 (AB)

Tests adding attribute at multiple levels

Test ab-add-attribute-027.xml is expected to pass.

The pipeline


      <p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="3.0">
         <p:output port="result"/>
         
         
         <p:add-attribute match="//html:*" attribute-value="html" attribute-name="class">
            <p:with-input>
               <html xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml">
                  <body xmlns="http://www.w3.org/1999/xhtml">
                     <h1 xmlns="http://www.w3.org/1999/xhtml">Header</h1>
                     <p xmlns="http://www.w3.org/1999/xhtml">Some text with <em xmlns="http://www.w3.org/1999/xhtml">emphazised</em> phrase.</p>
                     <ul xmlns="http://www.w3.org/1999/xhtml">
                        <li xmlns="http://www.w3.org/1999/xhtml">item</li>
                        <li xmlns="http://www.w3.org/1999/xhtml"><p xmlns="http://www.w3.org/1999/xhtml">item</p></li>
                        <li xmlns="http://www.w3.org/1999/xhtml"><p xmlns="http://www.w3.org/1999/xhtml"><b xmlns="http://www.w3.org/1999/xhtml">bold</b></p></li>
                     </ul>
                  </body>
               </html>
            </p:with-input>
         </p:add-attribute>
      </p:declare-step>
   
MorganaXProc passing

Schematron validation


      <s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron">
         <s:ns prefix="html" uri="http://www.w3.org/1999/xhtml"/>
         <s:pattern>
            <s:rule context="/">
               <s:assert test="html:html">The document root is not "html:html".</s:assert>
               <s:assert test="html:html/@class='html'">Element "html:html" does not have @class='html'.</s:assert>
               <s:assert test="html:html/html:body/@class='html'">Element "html/body" does not have @class='html'.</s:assert>
               <s:assert test="html:html/html:body/html:h1/@class='html'">Element "html/body/h1" does not have @class='html'.</s:assert>
               <s:assert test="html:html/html:body/html:p/@class='html'">Element "html/body/p" does not have @class='html'.</s:assert>
               <s:assert test="html:html/html:body/html:p/html:em/@class='html'">Element "html/body/p/em" does not have @class='html'.</s:assert>
               <s:assert test="html:html/html:body/html:ul/@class='html'">Element "html/body/ul" does not have @class='html'.</s:assert>               
               <s:assert test="html:html/html:body/html:ul/html:li/@class='html'">Element "html/body/ul/li" does not have @class='html'.</s:assert>               
               <s:assert test="html:html/html:body/html:ul/html:li[2]/html:p/@class='html'">Element "html/body/ul/li[2]/p" does not have @class='html'.</s:assert>
               <s:assert test="html:html/html:body/html:ul/html:li[3]/html:p/@class='html'">Element "html/body/ul/li[3]/p" does not have @class='html'.</s:assert>               
               <s:assert test="html:html/html:body/html:ul/html:li[3]/html:p//html:b/@class='html'">Element "html/body/ul/li[3]/p/b" does not have @class='html'.</s:assert>                              
            </s:rule>
         </s:pattern>
      </s:schema>
   

Revision history

16 Feb 2019, Achim Berndzen

Added new tests for p:add-attribute.