Work in progress adding support for OpenStack apiref page output.

This commit is contained in:
dcramer
2012-01-28 15:47:36 -06:00
parent 8a32fd6a93
commit b2d099939c
9 changed files with 1037 additions and 7 deletions

View File

@@ -432,15 +432,15 @@
<executions>
<execution>
<id>generate-xhtml</id>
<id>generate-html</id>
<goals>
<goal>build</goal>
</goals>
<configuration>
<type>xhtml</type>
<superClassName>com.rackspace.cloud.api.docs.HTMLMojo</superClassName>
<type>html</type>
<superClassName>com.rackspace.cloud.api.docs.ApiRefMojo</superClassName>
<excludedProperties>${excluded.properties},root.filename,base.dir</excludedProperties>
</configuration>
</execution>

View File

@@ -0,0 +1,26 @@
package com.rackspace.cloud.api.docs;
import com.agilejava.docbkx.maven.AbstractHtmlMojo;
import com.agilejava.docbkx.maven.PreprocessingFilter;
import com.agilejava.docbkx.maven.TransformerBuilder;
import org.apache.maven.plugin.MojoExecutionException;
import java.io.File;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.Source;
public abstract class ApiRefMojo extends AbstractHtmlMojo {
protected String getNonDefaultStylesheetLocation() {
return "cloud/apipage/apipage.xsl";
}
@Override
protected Source createSource(String inputFilename, File sourceFile, PreprocessingFilter filter)
throws MojoExecutionException {
String pathToPipelineFile = "classpath:/wadl2html.xpl"; //use "classpath:/path" for this to work
Source source = super.createSource(inputFilename, sourceFile, filter);
return CalabashHelper.createSource(source, pathToPipelineFile);
}
}

View File

@@ -1,6 +1,26 @@
package com.rackspace.cloud.api.docs;
import com.agilejava.docbkx.maven.AbstractHtmlMojo;
import com.agilejava.docbkx.maven.PreprocessingFilter;
import com.agilejava.docbkx.maven.TransformerBuilder;
import org.apache.maven.plugin.MojoExecutionException;
import java.io.File;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.Source;
public abstract class HTMLMojo extends AbstractHtmlMojo {
protected String getNonDefaultStylesheetLocation() {
return "cloud/apipage/apipage.xsl";
}
@Override
protected Source createSource(String inputFilename, File sourceFile, PreprocessingFilter filter)
throws MojoExecutionException {
String pathToPipelineFile = "classpath:/wadl2html.xpl"; //use "classpath:/path" for this to work
Source source = super.createSource(inputFilename, sourceFile, filter);
return CalabashHelper.createSource(source, pathToPipelineFile);
}
}

View File

@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:classpath="http://docs.rackspace.com/api"
xmlns:cx="http://xmlcalabash.com/ns/extensions"
xmlns:d="http://docbook.org/ns/docbook"
xmlns:l="http://xproc.org/library"
xmlns:rax="http://docs.rackspace.com/api"
xmlns:wadl="http://wadl.dev.java.net/2009/02"
exclude-result-prefixes="classpath cx d l rax wadl"
version="1.0">
<xsl:output
method="html"
indent="yes"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>
<xsl:template match="node() | @*" priority="-2">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="*">
<xsl:element name="{name()}" namespace="{namespace-uri()}">
<xsl:variable name="vtheElem" select="."/>
<xsl:for-each select="namespace::*">
<xsl:variable name="vPrefix" select="name()"/>
<xsl:if test=
"$vtheElem/descendant::*
[namespace-uri()=current()
and
substring-before(name(),':') = $vPrefix
or
@*[substring-before(name(),':') = $vPrefix]
]
">
<xsl:copy-of select="."/>
</xsl:if>
</xsl:for-each>
<xsl:apply-templates select="node()|@*"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>

View File

@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step
xmlns:p="http://www.w3.org/ns/xproc"
xmlns:l="http://xproc.org/library"
type="l:programlisting-keep-together"
xmlns:c="http://www.w3.org/ns/xproc-step" version="1.0"
name="main">
<p:input port="source"/>
<p:output port="result" primary="true">
<p:pipe step="programlisting-keep-together-xslt" port="result"/>
</p:output>
<p:xslt name="programlisting-keep-together-xslt">
<p:input port="source">
<p:pipe step="main" port="source"/>
</p:input>
<p:input port="stylesheet">
<p:inline>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:db="http://docbook.org/ns/docbook"
exclude-result-prefixes="xs" version="2.0">
<xsl:template match="/">
<xsl:apply-templates/>
<xsl:message>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!! In programlisting-keep-together-xslt !!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
</xsl:message>
</xsl:template>
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
<xsl:param name="max">8</xsl:param>
<xsl:template match="db:programlisting">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:if test="count(tokenize(.,'&#xA;')) &lt; $max">
<xsl:processing-instruction name="rax-fo">keep-together</xsl:processing-instruction>
<xsl:comment>linefeeds: <xsl:value-of select="count(tokenize(.,'&#xA;'))"/></xsl:comment>
</xsl:if>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="processing-instruction('rax')[normalize-space(.) = 'fail']">
<xsl:message terminate="yes">
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
&lt;?rax fail?> found in the document.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
</xsl:message>
</xsl:template>
</xsl:stylesheet>
</p:inline>
<!--<p:document href="cloud/code-listing-keep-together.xsl"/>-->
</p:input>
<p:input port="parameters" >
<p:empty/>
</p:input>
</p:xslt>
</p:declare-step>

View File

@@ -0,0 +1,254 @@
<p:library xmlns:p="http://www.w3.org/ns/xproc"
xmlns:cx="http://xmlcalabash.com/ns/extensions"
xmlns:ml="http://xmlcalabash.com/ns/extensions/marklogic"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
version="1.0">
<p:declare-step type="l:validate-transform"
version="1.0"
xmlns:p="http://www.w3.org/ns/xproc"
xmlns:l="http://xproc.org/library"
name="main">
<p:input port="source" /> <!--sequence="false" primary="true"-->
<p:input port="schema" sequence="true" >
<p:document href="classpath:/rng/rackbook.rng"/> <!--http://docs-beta.rackspace.com/oxygen/13.1/mac/author/frameworks/rackbook/5.0/-->
</p:input>
<p:output port="result" primary="true">
<!-- <p:pipe step="programlisting-keep-together-xslt" port="result"/> -->
<p:pipe step="tryvalidation" port="result"/>
</p:output>
<p:output port="report" sequence="true">
<p:pipe step="tryvalidation" port="report"/>
</p:output>
<p:try name="tryvalidation">
<p:group>
<p:output port="result">
<p:pipe step="xmlvalidate" port="result"/>
</p:output>
<p:output port="report" sequence="true">
<p:empty/>
</p:output>
<p:validate-with-relax-ng name="xmlvalidate" assert-valid="true">
<p:input port="source">
<p:pipe step="main" port="source"/>
</p:input>
<p:input port="schema">
<p:pipe step="main" port="schema"/>
</p:input>
</p:validate-with-relax-ng>
</p:group>
<p:catch name="catch">
<p:output port="result">
<p:pipe step="main" port="source"/>
</p:output>
<p:output port="report">
<p:pipe step="id" port="result"/>
</p:output>
<p:xslt name="id">
<p:input port="source">
<p:pipe step="catch" port="error"/>
</p:input>
<p:input port="stylesheet">
<p:inline>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:param name="failonerror">no</xsl:param>
<xsl:template match="node()|@*">
<xsl:message terminate="{$failonerror}">
@@@@@@@@@@@@@@@@@@@@@@
!!!VALIDATION ERROR!!!
!!!!!!!!!!!!!!!!!!!!!!
<xsl:copy-of select="."/>
!!!!!!!!!!!!!!!!!!!!!!
!!!VALIDATION ERROR!!!
@@@@@@@@@@@@@@@@@@@@@@
</xsl:message>
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
</p:inline>
</p:input>
<p:input port="parameters" >
<p:empty/>
</p:input>
</p:xslt>
</p:catch>
</p:try>
</p:declare-step>
<p:declare-step
xmlns:p="http://www.w3.org/ns/xproc"
xmlns:l="http://xproc.org/library"
type="l:programlisting-keep-together"
xmlns:c="http://www.w3.org/ns/xproc-step" version="1.0"
name="main">
<p:input port="source"/>
<p:output port="result" primary="true">
<p:pipe step="programlisting-keep-together-xslt" port="result"/>
</p:output>
<p:xslt name="programlisting-keep-together-xslt">
<p:input port="source">
<p:pipe step="main" port="source"/>
</p:input>
<p:input port="stylesheet">
<p:inline>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:db="http://docbook.org/ns/docbook"
exclude-result-prefixes="xs" version="2.0">
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
<xsl:param name="max">8</xsl:param>
<xsl:template match="db:programlisting">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:if test="count(tokenize(.,'&#xA;')) &lt; $max">
<xsl:processing-instruction name="rax-fo">keep-together</xsl:processing-instruction>
<xsl:comment>linefeeds: <xsl:value-of select="count(tokenize(.,'&#xA;'))"/></xsl:comment>
</xsl:if>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="processing-instruction('rax')[normalize-space(.) = 'fail']">
<xsl:message terminate="yes">
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
&lt;?rax fail?> found in the document.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
</xsl:message>
</xsl:template>
</xsl:stylesheet>
</p:inline>
<!--<p:document href="cloud/code-listing-keep-together.xsl"/>-->
</p:input>
<p:input port="parameters" >
<p:empty/>
</p:input>
</p:xslt>
</p:declare-step>
<p:declare-step
xmlns:p="http://www.w3.org/ns/xproc"
xmlns:l="http://xproc.org/library"
type="l:xhtml2docbook"
xmlns:c="http://www.w3.org/ns/xproc-step" version="1.0"
name="main">
<p:input port="source"/>
<p:output port="result" primary="true">
<p:pipe step="xhtml2docbook" port="result"/>
</p:output>
<p:xslt name="xhtml2docbook">
<p:input port="source"/>
<p:input port="stylesheet">
<p:inline>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns="http://docbook.org/ns/docbook"
exclude-result-prefixes="xhtml" version="2.0">
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="xhtml:p" >
<para>
<xsl:if test="@class='shortdesc'"><xsl:attribute name="role">shortdesc</xsl:attribute></xsl:if>
<xsl:apply-templates />
</para>
</xsl:template>
<xsl:template match="@class"/>
<xsl:template match="xhtml:b|xhtml:strong">
<emphasis role="bold"><xsl:apply-templates/></emphasis>
</xsl:template>
<xsl:template match="xhtml:a[@href]">
<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@href}"><xsl:apply-templates /></link>
</xsl:template>
<xsl:template match="xhtml:i|xhtml:em">
<emphasis><xsl:apply-templates /></emphasis>
</xsl:template>
<xsl:template match="xhtml:code|xhtml:tt">
<code><xsl:apply-templates /></code>
</xsl:template>
<xsl:template match="xhtml:span|xhtml:div">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="xhtml:ul">
<itemizedlist>
<xsl:apply-templates/>
</itemizedlist>
</xsl:template>
<xsl:template match="xhtml:ol" >
<orderedlist>
<xsl:apply-templates/>
</orderedlist>
</xsl:template>
<!-- TODO: Try to make this less brittle. What if they have a li/ul or li/table? -->
<xsl:template match="xhtml:li[not(xhtml:p)]">
<listitem>
<para>
<xsl:apply-templates/>
</para>
</listitem>
</xsl:template>
<xsl:template match="xhtml:li[xhtml:p]">
<listitem>
<xsl:apply-templates/>
</listitem>
</xsl:template>
<xsl:template match="xhtml:table">
<informaltable>
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="xhtml2docbookns"/>
</informaltable>
</xsl:template>
<xsl:template match="xhtml:pre">
<programlisting><xsl:apply-templates/></programlisting>
</xsl:template>
</xsl:stylesheet>
</p:inline>
<!--<p:document href="cloud/process-embedded-wadl.xsl"/>-->
</p:input>
<p:input port="parameters" >
<p:empty/>
</p:input>
</p:xslt>
</p:declare-step>
</p:library>

View File

@@ -85,7 +85,7 @@
</xsl:stylesheet>
</p:inline>
</p:input>
<p:input port="parameters" sequence="true">
<p:input port="parameters" >
<p:empty/>
</p:input>
</p:xslt>
@@ -149,11 +149,52 @@
</xsl:copy>
</xsl:template>
<xsl:template match="processing-instruction('rax')[normalize-space(.) = 'fail']">
<xsl:message terminate="yes">
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
&lt;?rax fail?> found in the document.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
</xsl:message>
</xsl:template>
</xsl:stylesheet>
</p:inline>
<!--<p:document href="cloud/code-listing-keep-together.xsl"/>-->
</p:input>
<p:input port="parameters" sequence="true">
<p:input port="parameters" >
<p:empty/>
</p:input>
</p:xslt>
<p:xslt name="process-embedded-wadl">
<p:input port="source">
<p:pipe step="programlisting-keep-together-xslt" port="result"/>
</p:input>
<p:input port="stylesheet">
<p:inline>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:db="http://docbook.org/ns/docbook"
exclude-result-prefixes="xs" version="2.0">
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/">
<xsl:apply-templates/>
<xsl:message>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
THIS WORKS!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
</xsl:message>
</xsl:template>
</xsl:stylesheet>
</p:inline>
<!--<p:document href="cloud/process-embedded-wadl.xsl"/>-->
</p:input>
<p:input port="parameters" >
<p:empty/>
</p:input>
</p:xslt>

View File

@@ -0,0 +1,81 @@
<p:declare-step version="1.0"
xmlns:p="http://www.w3.org/ns/xproc"
xmlns:l="http://xproc.org/library"
type="l:validate-transform"
name="main">
<p:input port="source" /> <!--sequence="false" primary="true"-->
<p:input port="schema" sequence="true" >
<p:document href="classpath:/rng/rackbook.rng"/> <!--http://docs-beta.rackspace.com/oxygen/13.1/mac/author/frameworks/rackbook/5.0/-->
</p:input>
<p:output port="result" primary="true">
<!-- <p:pipe step="programlisting-keep-together-xslt" port="result"/> -->
<p:pipe step="tryvalidation" port="result"/>
</p:output>
<p:output port="report" sequence="true">
<p:pipe step="tryvalidation" port="report"/>
</p:output>
<p:try name="tryvalidation">
<p:group>
<p:output port="result">
<p:pipe step="xmlvalidate" port="result"/>
</p:output>
<p:output port="report" sequence="true">
<p:empty/>
</p:output>
<p:validate-with-relax-ng name="xmlvalidate" assert-valid="true">
<p:input port="source">
<p:pipe step="main" port="source"/>
</p:input>
<p:input port="schema">
<p:pipe step="main" port="schema"/>
</p:input>
</p:validate-with-relax-ng>
</p:group>
<p:catch name="catch">
<p:output port="result">
<p:pipe step="main" port="source"/>
</p:output>
<p:output port="report">
<p:pipe step="id" port="result"/>
</p:output>
<p:xslt name="id">
<p:input port="source">
<p:pipe step="catch" port="error"/>
</p:input>
<p:input port="stylesheet">
<p:inline>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:param name="failonerror">no</xsl:param>
<xsl:template match="node()|@*">
<xsl:message terminate="{$failonerror}">
@@@@@@@@@@@@@@@@@@@@@@
!!!VALIDATION ERROR!!!
!!!!!!!!!!!!!!!!!!!!!!
<xsl:copy-of select="."/>
!!!!!!!!!!!!!!!!!!!!!!
!!!VALIDATION ERROR!!!
@@@@@@@@@@@@@@@@@@@@@@
</xsl:message>
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
</p:inline>
</p:input>
<p:input port="parameters" >
<p:empty/>
</p:input>
</p:xslt>
</p:catch>
</p:try>
</p:declare-step>

View File

@@ -0,0 +1,491 @@
<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step version="1.0"
xmlns:p="http://www.w3.org/ns/xproc"
xmlns:l="http://xproc.org/library"
xmlns:classpath="http://docs.rackspace.com/api"
xmlns:cx="http://xmlcalabash.com/ns/extensions"
name="main">
<p:input port="source"/>
<p:output port="result"/>
<p:import href="http://xmlcalabash.com/extension/steps/library-1.0.xpl"/>
<p:import href="classpath:/rackspace-library.xpl"/>
<cx:message>
<p:with-option name="message" select="'Entering xproc pipeline'"/>
</cx:message>
<l:validate-transform name="validate-pre-xinclude">
<p:input port="schema" >
<p:document href="classpath:/rng/rackbook.rng"/>
</p:input>
</l:validate-transform>
<p:xinclude/>
<cx:message>
<p:with-option name="message" select="'Validating post-xinclude'"/>
</cx:message>
<l:validate-transform name="validate-post-xinclude">
<p:input port="schema" >
<p:document href="classpath:/rng/rackbook.rng"/>
</p:input>
</l:validate-transform>
<p:xslt name="process-embedded-wadl">
<p:input port="source">
<p:pipe step="validate-post-xinclude" port="result"/>
</p:input>
<p:input port="stylesheet">
<p:inline>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:wadl="http://wadl.dev.java.net/2009/02"
xmlns:rax="http://docs.rackspace.com/api"
xmlns:d="http://docbook.org/ns/docbook"
exclude-result-prefixes="xs d wadl rax" version="2.0">
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
<xsl:param name="compute.wadl.path.from.docbook.path">0</xsl:param>
<xsl:template match="wadl:resources[@href]">
<xsl:variable name="wadl.path">
<xsl:call-template name="wadlPath">
<xsl:with-param name="path" select="@href"/>
</xsl:call-template>
</xsl:variable>
<xsl:apply-templates select="document($wadl.path)//wadl:resource"/>
</xsl:template>
<xsl:template match="wadl:resources">
<xsl:apply-templates select="wadl:resource"/>
</xsl:template>
<xsl:template match="wadl:resource[@href]">
<xsl:variable name="wadl.path">
<xsl:call-template name="wadlPath">
<xsl:with-param name="path" select="@href"/>
</xsl:call-template>
</xsl:variable>
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:choose>
<xsl:when test="@href and not(./wadl:method)">
<xsl:apply-templates
select="document($wadl.path)//wadl:resource[@id = substring-after(current()/@href,'#')]/wadl:method">
<xsl:with-param name="resourceLink" select="."/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates
select="document($wadl.path)//wadl:resource[@id = substring-after(current()/@href,'#')]/wadl:method[@rax:id = current()/wadl:method/@href]">
<xsl:with-param name="resourceLink" select="."/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:copy>
</xsl:template>
<xsl:template name="wadlPath">
<xsl:param name="path"/>
<xsl:choose>
<xsl:when test="contains($path,'#')">
<xsl:call-template name="wadlPath">
<xsl:with-param name="path"
select="substring-before($path,'#')"/>
</xsl:call-template>
</xsl:when>
<xsl:when
test="$compute.wadl.path.from.docbook.path = '0' and contains($path,'\')">
<xsl:call-template name="wadlPath">
<xsl:with-param name="path"
select="substring-after($path,'\')"/>
</xsl:call-template>
</xsl:when>
<xsl:when
test="$compute.wadl.path.from.docbook.path = '0' and contains($path,'/')">
<xsl:call-template name="wadlPath">
<xsl:with-param name="path"
select="substring-after($path,'/')"/>
</xsl:call-template>
</xsl:when>
<xsl:when
test="$compute.wadl.path.from.docbook.path = '0'">
<xsl:value-of
select="concat('target/generated-resources/xml/xslt/',$path)"
/>
</xsl:when>
<xsl:otherwise>
<xsl:message terminate="yes"> ERROR:
compute.wadl.path.from.docbook.path=1 not yet
supported </xsl:message>
<!-- <xsl:value-of
select="concat('target/generated-resources/xml/xslt',$docbook.partial.path, $path)"
/>-->
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
</p:inline>
<!--<p:document href="cloud/process-embedded-wadl.xsl"/>-->
</p:input>
<p:input port="parameters" >
<p:empty/>
</p:input>
</p:xslt>
<l:xhtml2docbook name="xhtml2docbook"/>
<!--
<l:programlisting-keep-together name="programlisting-keep-together"/>
-->
<p:xslt name="docbook2apipage">
<p:input port="source">
<p:pipe step="programlisting-keep-together" port="result"/>
</p:input>
<p:input port="stylesheet">
<p:inline>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:wadl="http://wadl.dev.java.net/2009/02"
xmlns:rax="http://docs.rackspace.com/api"
xmlns:d="http://docbook.org/ns/docbook"
xmlns="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="xhtml" version="2.0">
<xsl:output
method="xhtml"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="wadl:method" mode="processDetailsBtn">
<xsl:variable name="id" select="genrate-id()"/>
processADetailBtn(theText,'<xsl:comment><xsl:value-of select="$id"/>_btn_section START</xsl:comment>','<xsl:comment><xsl:value-of select="$id"/>_btn_section END</xsl:comment>','<xsl:value-of select="$id"/>');
processSelection(theText,'<xsl:comment><xsl:value-of select="$id"/>_req_xml_selection START</xsl:comment>','<xsl:comment><xsl:value-of select="$id"/>_req_xml_selection END</xsl:comment>','generate_token','<xsl:value-of select="$id"/>_req_xml');
processSelection(theText,'<xsl:comment><xsl:value-of select="$id"/>_resp_xml_selection START</xsl:comment>','<xsl:comment><xsl:value-of select="$id"/>_resp_xml_selection END</xsl:comment>','generate_token','<xsl:value-of select="$id"/>_resp_xml');
</xsl:template>
<xsl:template match="wadl:method" mode="setSectionsNSelections">
<xsl:variable name="id" select="genrate-id()"/>
$("#<xsl:value-of select="$id"/>.hide();
$("#<xsl:value-of select="$id"/>_select").val("xml");
</xsl:template>
<xsl:template match="wadl:method" mode="showSelected">
<xsl:variable name="id" select="genrate-id()"/>
if(selectorId=='<xsl:value-of select="$id"/>_select'){
<xsl:if test="position() = first()">else </xsl:if>if(optoinId=='xml'){
$("#<xsl:value-of select="$id"/>_json").hide();
$("#<xsl:value-of select="$id"/>_xml").show();
}else{
$("#<xsl:value-of select="$id"/>_xml").hide();
$("#<xsl:value-of select="$id"/>_json").show();
}
}
</xsl:template>
<xsl:template match="d:book">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>OpenStack API Documentation</title>
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/1.4.0/bootstrap.min.css"/>
<!-- OpenStack Specific CSS -->
<link rel="stylesheet" href="css/bootstrap-screen.css" type="text/css" media="screen, projection"/>
<link rel="stylesheet" href="css/main.css" type="text/css" media="screen, projection, print"/>
<script type="text/javascript" src="js/main.js">&#x200B;</script>
<script type="text/javascript">
<!-- TODO: Write out vars from main here -->
function processDetailsBtn(theText){
<xsl:apply-templates select="//wadl:method" mode="processDetailsBtn"/>
}
function setSectionsNSelections(){
<xsl:apply-templates select="//wadl:method" mode="setSectionsNSelections"/>
}
function showSelected(selectorId, optionId){
<xsl:apply-templates select="//wadl:method" mode="showSelected"/>
}
</script>
<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.2.6.min.js">&#x200B;</script>
</head>
<body>
<form action="#">
<div id="wrapper">
<div class="container">
<div id="header">
<div class="span-5">
<h1 id="logo"><a href="/">Open Stack</a></h1>
</div>
<div class="span-19 last">
<div id="navigation">
<ul id="Menu1">
<li><a href="/" title="Go to the Home page">Home</a></li>
<li><a href="/projects/" title="Go to the OpenStack Projects page" class="link">Projects</a></li>
<li><a href="/community/" title="Go to the Community page" class="link">Community</a></li>
<li><a href="/blog/" title="Go to the OpenStack Blog">Blog</a></li>
<li><a href="http://wiki.openstack.org/" title="Go to the OpenStack Wiki">Wiki</a></li>
<li><a href="http://docs.openstack.org/" title="Go to OpenStack Documentation" class="current">Documentation</a></li>
</ul>
</div>
</div>
</div>
</div>
<div id="body">
<xsl:apply-templates/>
<div class="container">
<div id="footer">
<hr/>
<p>The OpenStack project is provided under the Apache 2.0 license.</p>
</div>
</div>
<div id="thebottom">&#x200B;</div>
</div>
</div>
<div id="rightColumn">
<div id="pageSearcher">&#160;</div>
</div>
<div class="clear">&#160;</div>
</form>
<script type="text/javascript">
jQuery.extend(
jQuery.expr[':'], { Contains : "jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0"
});
</script>
<script type="text/javascript">
$(document).ready(function() {
var pageSearcher = new Searcher.SearchPage();
pageSearcher.startSearchingLength = 3;
pageSearcher.init();
setSectionsNSelections();
});
</script>
</body>
</html>
</xsl:template>
<xsl:template match="d:preface|d:chapter">
<div class="container">
<h2><xsl:value-of select="d:title"/></h2>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="d:section">
<div>
<h3><xsl:value-of select="d:title"/></h3>
<xsl:apply-templates select="d:*"/>
<xsl:apply-templates select=".//wadl:method"/>
</div>
</xsl:template>
<xsl:template match="wadl:method">
<xsl:variable name="id"><xsl:value-of select="generate-id()"/></xsl:variable>
<div class="row {$id}">
<div class="span1">
<span class="label success"><xsl:value-of select="@name"/></span>
</div>
<div class="span5">
<xsl:value-of select="ancestor::wadl:resource/@path"/>
</div>
<div class="span6">
<xsl:value-of select="wadl:doc/para[@role='shortdesc']|wadl:docs/d:para/*[@role = 'shortdesc']"/>
</div>
<div class="span1">
<a href="#" class="btn small info" id="{$id}_btn" onclick="toggleDetailsBtn(event,'{$id}_btn','{$id}','{$id}_focus');">detail</a>
</div>
</div><xsl:comment> row </xsl:comment><xsl:text>
</xsl:text>
<div class="apidetail span16" id="{$id}_btn_section">
<xsl:comment> Do not edit or remove the next comment </xsl:comment><xsl:text>
</xsl:text>
<xsl:comment><xsl:value-of select="concat($id,'_section START')"/></xsl:comment><xsl:text>
</xsl:text>
<div class="row">
<!-- Description of method -->
<xsl:apply-templates
select="wadl:doc/*[not(@role = 'shortdesc')]"/>
</div>
<div class="row">
<div class="span16">
<!-- Don't output if there are no params -->
<xsl:if test=".//wadl:param">
<table class="zebra-striped">
<thead>
<tr>
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<xsl:apply-templates select=".//wadl:param" mode="param2tr">
<!-- Add templates to handle wadl:params -->
<xsl:with-param name="id" select="$id"/>
</xsl:apply-templates>
</tbody>
</table>
</xsl:if>
</div>
</div>
<!-- Examples -->
<xsl:choose>
<xsl:when
test="wadl:request/wadl:representation[ends-with(@mediaType,'/xml') ]/wadl:doc/d:example
and wadl:request/wadl:representation[ends-with(@mediaType,'/json')]/wadl:doc/d:example">
<select id="{$id}_req_select"
onchange="toggleSelection('auth_user_name_req_select');">
<option value="xml" selected="selected">Request XML</option>
<option value="json">Request JSON</option>
</select><xsl:text>
</xsl:text>
<xsl:comment> Do not delete or edit the next comment </xsl:comment><xsl:text>
</xsl:text>
<xsl:comment><xsl:value-of select="concat($id,'_xml_selection START')"/></xsl:comment><xsl:text>
</xsl:text>
<div class="example" id="{concat($id,'_xml')}">
<xsl:apply-templates select="wadl:request/wadl:representation[ends-with(@mediaType,'/xml') ]/wadl:doc/d:example"/>
</div>
<xsl:comment><xsl:value-of select="concat($id,'_xml_selection END')"/></xsl:comment><xsl:text>
</xsl:text>
<xsl:comment> Do not delete or edit the previous comment </xsl:comment><xsl:text>
</xsl:text>
<xsl:comment> Do not delete or edit the next comment </xsl:comment><xsl:text>
</xsl:text>
<xsl:comment><xsl:value-of select="concat($id,'_json_selection START')"/></xsl:comment><xsl:text>
</xsl:text>
<div class="example" id="{concat($id,'_json')}">
<xsl:apply-templates select="wadl:request/wadl:representation[ends-with(@mediaType,'/json') ]/wadl:doc/d:example"/>
</div>
<xsl:comment><xsl:value-of select="concat($id,'_json_selection END')"/></xsl:comment><xsl:text>
</xsl:text>
<xsl:comment> Do not delete or edit the previous comment </xsl:comment><xsl:text>
</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="wadl:request/wadl:representation/wadl:doc/d:example"/>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when
test="wadl:response/wadl:representation[ends-with(@mediaType,'/xml') ]/wadl:doc/d:example
and wadl:response/wadl:representation[ends-with(@mediaType,'/json')]/wadl:doc/d:example">
<select id="{$id}_resp_select"
onchange="toggleSelection('auth_user_name_resp_select');">
<option value="xml" selected="selected">Response XML</option>
<option value="json">Response JSON</option>
</select><xsl:text>
</xsl:text>
<xsl:comment> Do not delete or edit the next comment </xsl:comment>
<xsl:comment><xsl:value-of select="concat($id,'_xml_selection START')"/></xsl:comment>
<div class="example" id="{concat($id,'_xml')}">
<xsl:apply-templates select="wadl:response/wadl:representation[ends-with(@mediaType,'/xml') ]/wadl:doc/d:example"/>
</div><xsl:text>
</xsl:text>
<xsl:comment><xsl:value-of select="concat($id,'_xml_selection END')"/></xsl:comment><xsl:text>
</xsl:text>
<xsl:comment> Do not delete or edit the previous comment </xsl:comment><xsl:text>
</xsl:text>
<xsl:comment> Do not delete or edit the next comment </xsl:comment><xsl:text>
</xsl:text>
<xsl:comment><xsl:value-of select="concat($id,'_json_selection START')"/></xsl:comment><xsl:text>
</xsl:text>
<div class="example" id="{concat($id,'_json')}">
<xsl:apply-templates select="wadl:response/wadl:representation[ends-with(@mediaType,'/json') ]/wadl:doc/d:example"/>
</div>
<xsl:comment><xsl:value-of select="concat($id,'_json_selection END')"/></xsl:comment><xsl:text>
</xsl:text>
<xsl:comment> Do not delete or edit the previous comment </xsl:comment><xsl:text>
</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="wadl:response/wadl:representation/wadl:doc/d:example"/>
</xsl:otherwise>
</xsl:choose>
</div>
<xsl:comment><xsl:value-of select="concat($id,'_section END')"/></xsl:comment>
<xsl:comment> Do not edit or remove the previous comment </xsl:comment>
</xsl:template>
<xsl:template match="wadl:doc|wadl:resource|wadl:link">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="d:para">
<p><xsl:apply-templates/></p>
</xsl:template>
<xsl:template match="d:link" xmlns:xlink="http://www.w3.org/1999/xlink">
<a href="{xlink:href}"><xsl:apply-templates/></a>
</xsl:template>
<xsl:template match="d:programlisting">
<pre><xsl:apply-templates/></pre>
</xsl:template>
<xsl:template match="d:title[parent::d:chapter or parent::d:section or parent::d:book]|d:info|wadl:param"/>
<xsl:template match="d:example/d:title">
<b><xsl:apply-templates/></b>
</xsl:template>
<xsl:template match="d:example">
<div class="example">
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="wadl:param" mode="param2tr">
<tr>
<td><xsl:value-of select="@name"/><xsl:if test="not(@required = 'true')"> (Optional)</xsl:if></td>
<td><xsl:apply-templates select="./wadl:doc/*"/></td>
</tr>
</xsl:template>
<xsl:template match="d:code"><code><xsl:apply-templates/></code></xsl:template>
<xsl:template match="d:*"><xsl:apply-templates/></xsl:template>
</xsl:stylesheet>
</p:inline>
</p:input>
<p:input port="parameters" >
<p:empty/>
</p:input>
</p:xslt>
<!-- <p:xslt name="foo">
<p:input port="source">
<p:pipe step="process-embedded-wadl" port="result"/>
</p:input>
<p:input port="stylesheet">
<p:inline>
</p:inline>
</p:input>
</p:xslt>-->
<cx:message>
<p:with-option name="message" select="'Exiting xproc pipeline'"/>
</cx:message>
</p:declare-step>