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

Converted WADL documentation to XSLT 2.0.

Gets rid of EXSLT, works with Saxon HE
parent b2ca36b1
No related branches found
No related tags found
No related merge requests found
......@@ -28,13 +28,11 @@
-->
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
xmlns:wadl="http://wadl.dev.java.net/2009/02"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:exsl="http://exslt.org/common"
xmlns:ns="urn:namespace"
extension-element-prefixes="exsl"
xmlns="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="xsl wadl xs html ns"
>
......@@ -169,7 +167,7 @@
<xsl:copy-of select="/wadl:application/wadl:grammars/*[not(namespace-uri()=$wadl-ns)]"/>
<xsl:apply-templates select="/wadl:application/wadl:grammars/wadl:include[@href]" mode="include-grammar"/>
<xsl:apply-templates select="/wadl:application/wadl:resources/descendant::wadl:resource[@type]" mode="include-href"/>
<xsl:apply-templates select="exsl:node-set($resources)/descendant::wadl:*[@href]" mode="include-href"/>
<xsl:apply-templates select="$resources/descendant::wadl:*[@href]" mode="include-href"/>
</xsl:variable>
<xsl:template match="wadl:include[@href]" mode="include-grammar">
......@@ -299,27 +297,27 @@
<xsl:apply-templates select="wadl:doc"/>
<ul>
<li><a href="#resources">Resources</a>
<xsl:apply-templates select="exsl:node-set($resources)" mode="toc"/>
<xsl:apply-templates select="$resources" mode="toc"/>
</li>
<li><a href="#representations">Representations</a>
<ul>
<xsl:apply-templates select="exsl:node-set($resources)/descendant::wadl:representation" mode="toc"/>
<xsl:apply-templates select="$resources/descendant::wadl:representation" mode="toc"/>
</ul>
</li>
<xsl:if test="descendant::wadl:fault">
<li><a href="#faults">Faults</a>
<ul>
<xsl:apply-templates select="exsl:node-set($resources)/descendant::wadl:fault" mode="toc"/>
<xsl:apply-templates select="$resources/descendant::wadl:fault" mode="toc"/>
</ul>
</li>
</xsl:if>
</ul>
<h2 id="resources">Resources</h2>
<xsl:apply-templates select="exsl:node-set($resources)" mode="list"/>
<xsl:apply-templates select="$resources" mode="list"/>
<h2 id="representations">Representations</h2>
<xsl:apply-templates select="exsl:node-set($resources)/descendant::wadl:representation" mode="list"/>
<xsl:if test="exsl:node-set($resources)/descendant::wadl:fault"><h2 id="faults">Faults</h2>
<xsl:apply-templates select="exsl:node-set($resources)/descendant::wadl:fault" mode="list"/>
<xsl:apply-templates select="$resources/descendant::wadl:representation" mode="list"/>
<xsl:if test="$resources/descendant::wadl:fault"><h2 id="faults">Faults</h2>
<xsl:apply-templates select="$resources/descendant::wadl:fault" mode="list"/>
</xsl:if>
</body>
</html>
......@@ -658,7 +656,7 @@
<xsl:value-of select="$qname-ns-uri"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="exsl:node-set($resources)/*[1]/attribute::*[namespace-uri()='urn:namespace' and local-name()=$prefix]"/>
<xsl:value-of select="$resources/*[1]/attribute::*[namespace-uri()='urn:namespace' and local-name()=$prefix]"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
......@@ -673,7 +671,7 @@
</xsl:call-template>
</xsl:variable>
<xsl:variable name="localname" select="substring-after($qname, ':')"/>
<xsl:variable name="definition" select="exsl:node-set($grammars)/descendant::xs:element[@name=$localname][ancestor-or-self::*[@targetNamespace=$ns-uri]]"/>
<xsl:variable name="definition" select="$grammars/descendant::xs:element[@name=$localname][ancestor-or-self::*[@targetNamespace=$ns-uri]]"/>
<xsl:variable name='source' select="$definition/ancestor-or-self::wadl:include[1]/@href"/>
<p><em>Source: <a href="{$source}"><xsl:value-of select="$source"/></a></em></p>
<pre><xsl:apply-templates select="$definition" mode="encode"/></pre>
......@@ -694,7 +692,7 @@
<a href="http://www.w3.org/TR/xmlschema-2/#{$localname}"><xsl:value-of select="$localname"/></a>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="definition" select="exsl:node-set($grammars)/descendant::xs:*[@name=$localname][ancestor-or-self::*[@targetNamespace=$ns-uri]]"/>
<xsl:variable name="definition" select="$grammars/descendant::xs:*[@name=$localname][ancestor-or-self::*[@targetNamespace=$ns-uri]]"/>
<a href="{$definition/ancestor-or-self::wadl:include[1]/@href}" title="{$definition/descendant::xs:documentation/descendant::text()}"><xsl:value-of select="$localname"/></a>
</xsl:otherwise>
</xsl:choose>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment