XProc Unit Test: xslt001

Inputs

Port=source:

<document>
<title>Some Title</title>
<para>Some paragraph.</para>
</document>

Port=style:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
		xmlns="http://www.w3.org/1999/xhtml"
                version="1.0">

<xsl:output method="xml" encoding="utf-8" indent="no"/>

<xsl:template match="document">
  <html>
    <head>
      <title>
        <xsl:value-of select="title"/>
      </title>
    </head>
    <body>
      <h1>
        <xsl:value-of select="title"/>
      </h1>
      <xsl:apply-templates/>
    </body>
  </html>
</xsl:template>

<xsl:template match="title"/>

<xsl:template match="para">
  <p>
    <xsl:apply-templates/>
  </p>
</xsl:template>

</xsl:stylesheet>

Pipeline

pipeline:

<p:pipeline name="pipeline"
	    xmlns:p="http://www.w3.org/2007/03/xproc">
<p:input port="source"/>
<p:input port="style"/>
<p:output port="result"/>

<p:xslt>
  <p:input port="source">
    <p:pipe step="pipeline" port="source"/>
  </p:input>
  <p:input port="stylesheet">
    <p:pipe step="pipeline" port="style"/>
  </p:input>
</p:xslt>

</p:pipeline>

Outputs

Port=result:

<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Some Title</title></head><body><h1>Some Title</h1>

<p>Some paragraph.</p>
</body></html>