Skip to content
Snippets Groups Projects
Commit b79a2516 authored by Thorsten Vitt's avatar Thorsten Vitt
Browse files

Allow to ingest appname + a prolog HTML fragment

parent 8503ddbd
No related branches found
No related tags found
No related merge requests found
......@@ -14,8 +14,10 @@
import javax.ws.rs.core.UriInfo;
import javax.xml.transform.stream.StreamSource;
import net.sf.saxon.s9api.QName;
import net.sf.saxon.s9api.SaxonApiException;
import net.sf.saxon.s9api.Serializer;
import net.sf.saxon.s9api.XdmAtomicValue;
import net.sf.saxon.s9api.XsltTransformer;
import com.google.common.base.Optional;
......@@ -46,6 +48,7 @@ public void write(OutputStream output) throws IOException,
final Serializer serializer = stylesheetManager.xsltProcessor.newSerializer(output);
transformer.setDestination(serializer);
transformer.setSource(new StreamSource(wadlURL.openStream(), wadlURL.toString()));
transformer.setParameter(new QName("apptitle"), new XdmAtomicValue("TextGrid Aggregator Service"));
transformer.transform();
} catch (final SaxonApiException e) {
throw new WebApplicationException(e);
......
......@@ -47,7 +47,8 @@
/>
<xsl:variable name="wadl-ns">http://wadl.dev.java.net/2009/02</xsl:variable>
<xsl:param name="apptitle">My Web Application</xsl:param>
<xsl:param name="prologHtml"/>
<!-- expand @hrefs, @types into a full tree -->
......@@ -170,7 +171,7 @@
<xsl:apply-templates select="/wadl:application/wadl:resources/descendant::wadl:resource[@type]" mode="include-href"/>
<xsl:apply-templates select="$resources/descendant::wadl:*[@href]" mode="include-href"/>
</xsl:variable>
<xsl:param name="apptitle">My Web Application</xsl:param>
<xsl:template match="wadl:include[@href]" mode="include-grammar">
<xsl:variable name="included" select="document(@href, /)/*"></xsl:variable>
......@@ -313,6 +314,7 @@
<xsl:otherwise><xsl:value-of select="$apptitle"/></xsl:otherwise>
</xsl:choose>
</h1>
<xsl:value-of select="$prologHtml" disable-output-escaping="yes"/>
<xsl:apply-templates select="wadl:doc"/>
<ul>
<li><a href="#resources">Resources</a>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment