First cut at supporting wadls in random dirs, wadls with same name etc.
This commit is contained in:
@@ -270,6 +270,9 @@ public abstract class PDFMojo extends AbstractFoMojo {
|
|||||||
File imageDirectory = getImageDirectory();
|
File imageDirectory = getImageDirectory();
|
||||||
File calloutDirectory = new File (imageDirectory, "callouts");
|
File calloutDirectory = new File (imageDirectory, "callouts");
|
||||||
|
|
||||||
|
transformer.setParameter("docbook.infile",sourceDocBook.getAbsolutePath());
|
||||||
|
transformer.setParameter("source.directory",sourceDirectory);
|
||||||
|
|
||||||
transformer.setParameter ("admon.graphics.path", imageDirectory.getAbsolutePath()+File.separator);
|
transformer.setParameter ("admon.graphics.path", imageDirectory.getAbsolutePath()+File.separator);
|
||||||
transformer.setParameter ("callout.graphics.path", calloutDirectory.getAbsolutePath()+File.separator);
|
transformer.setParameter ("callout.graphics.path", calloutDirectory.getAbsolutePath()+File.separator);
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,9 @@ import com.agilejava.docbkx.maven.FileUtils;
|
|||||||
|
|
||||||
public abstract class WebHelpMojo extends AbstractWebhelpMojo {
|
public abstract class WebHelpMojo extends AbstractWebhelpMojo {
|
||||||
|
|
||||||
|
private File sourceDirectory;
|
||||||
|
private File sourceDocBook;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @parameter expression="${project.build.directory}"
|
* @parameter expression="${project.build.directory}"
|
||||||
*/
|
*/
|
||||||
@@ -149,6 +152,11 @@ public abstract class WebHelpMojo extends AbstractWebhelpMojo {
|
|||||||
transformer.setParameter("trim.wadl.uri.count",trimWadlUriCount);
|
transformer.setParameter("trim.wadl.uri.count",trimWadlUriCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sourceDocBook = new File(sourceFilename);
|
||||||
|
sourceDirectory = sourceDocBook.getParentFile();
|
||||||
|
transformer.setParameter("docbook.infile",sourceDocBook.getAbsolutePath());
|
||||||
|
transformer.setParameter("source.directory",sourceDirectory);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected TransformerBuilder createTransformerBuilder(URIResolver resolver) {
|
protected TransformerBuilder createTransformerBuilder(URIResolver resolver) {
|
||||||
|
|||||||
@@ -8,8 +8,22 @@
|
|||||||
<!-- <xsl:output indent="yes"/> -->
|
<!-- <xsl:output indent="yes"/> -->
|
||||||
|
|
||||||
<xsl:param name="project.build.directory">../../target</xsl:param>
|
<xsl:param name="project.build.directory">../../target</xsl:param>
|
||||||
|
<xsl:param name="docbook.infile"/>
|
||||||
|
<xsl:param name="source.directory"/>
|
||||||
|
<xsl:param name="docbook.partial.path">
|
||||||
|
<xsl:call-template name="getUrl">
|
||||||
|
<xsl:with-param name="path" select="substring-after($docbook.infile,$source.directory)"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:param>
|
||||||
|
<xsl:param name="docbook.partial.path.adjusted">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="$docbook.partial.path=''">/</xsl:when>
|
||||||
|
<xsl:otherwise><xsl:value-of select="$docbook.partial.path"/></xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
<xsl:param name="trim.wadl.uri.count">0</xsl:param>
|
<xsl:param name="trim.wadl.uri.count">0</xsl:param>
|
||||||
|
|
||||||
<xsl:variable name="root" select="/"/>
|
<xsl:variable name="root" select="/"/>
|
||||||
|
|
||||||
<!-- Uncomment this template for testing in Oxygen -->
|
<!-- Uncomment this template for testing in Oxygen -->
|
||||||
@@ -66,12 +80,12 @@
|
|||||||
|
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="wadl:resources[wadl:resource[not(./wadl:method)]]" mode="preprocess">
|
<!-- <xsl:template match="wadl:resources[wadl:resource[not(./wadl:method)]]" mode="preprocess"> -->
|
||||||
<section xml:id="{generate-id()}">
|
<!-- <section xml:id="{generate-id()}"> -->
|
||||||
<title>FOOBAR</title>
|
<!-- <title>FOOBAR</title> -->
|
||||||
<xsl:call-template name="wadl-resources"/>
|
<!-- <xsl:call-template name="wadl-resources"/> -->
|
||||||
</section>
|
<!-- </section> -->
|
||||||
</xsl:template>
|
<!-- </xsl:template> -->
|
||||||
|
|
||||||
<xsl:template match="wadl:resources" name="wadl-resources" mode="preprocess">
|
<xsl:template match="wadl:resources" name="wadl-resources" mode="preprocess">
|
||||||
<!-- Make a summary table then apply templates to wadl:resource/wadl:method (from wadl) -->
|
<!-- Make a summary table then apply templates to wadl:resource/wadl:method (from wadl) -->
|
||||||
@@ -100,12 +114,19 @@
|
|||||||
<xsl:with-param name="path" select="@href"/>
|
<xsl:with-param name="path" select="@href"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
|
<xsl:variable name="href" select="wadl:method/@href"/>
|
||||||
|
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="@href">
|
<xsl:when test="@href">
|
||||||
<xsl:apply-templates
|
<xsl:apply-templates mode="method-rows">
|
||||||
select="document($wadl.path,$root)//wadl:resource[@id = substring-after(current()/@href,'#')]/wadl:method[@rax:id = current()/wadl:method/@href]"
|
<xsl:with-param name="wadl.path" select="$wadl.path"/>
|
||||||
mode="method-rows"/>
|
<xsl:with-param name="resourceId" select="substring-after(current()/@href,'#')"/>
|
||||||
|
</xsl:apply-templates>
|
||||||
|
|
||||||
|
<!-- <xsl:apply-templates -->
|
||||||
|
<!-- select="document(concat('file:///', $wadl.path))//wadl:resource[@id = substring-after(current()/@href,'#')]/wadl:method" -->
|
||||||
|
<!-- mode="method-rows"/> --> <!--[@rax:id = $href]-->
|
||||||
|
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:apply-templates select="wadl:method" mode="method-rows"/>
|
<xsl:apply-templates select="wadl:method" mode="method-rows"/>
|
||||||
@@ -113,6 +134,31 @@
|
|||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="wadl:method[@href]" mode="method-rows">
|
||||||
|
<xsl:param name="wadl.path"/>
|
||||||
|
<xsl:param name="resourceId"/>
|
||||||
|
|
||||||
|
<xsl:apply-templates
|
||||||
|
select="document(concat('file:///', $wadl.path))//wadl:resource[@id = $resourceId]/wadl:method[@rax:id = current()/@href]"
|
||||||
|
mode="method-rows"/>
|
||||||
|
|
||||||
|
<xsl:message>
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
<xsl:value-of
|
||||||
|
select="$wadl.path"
|
||||||
|
/>
|
||||||
|
|
||||||
|
.="<xsl:copy-of select="."/>"
|
||||||
|
-----------------------------
|
||||||
|
<xsl:apply-templates
|
||||||
|
select="document(concat('file:///', $wadl.path))//wadl:resource[@id = $resourceId]/wadl:method[@rax:id = current()/@href]"
|
||||||
|
mode="method-rows"/>
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
</xsl:message>
|
||||||
|
|
||||||
|
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="wadl:resource" mode="preprocess">
|
<xsl:template match="wadl:resource" mode="preprocess">
|
||||||
<xsl:variable name="wadl.path">
|
<xsl:variable name="wadl.path">
|
||||||
<xsl:call-template name="wadlPath">
|
<xsl:call-template name="wadlPath">
|
||||||
@@ -123,7 +169,7 @@
|
|||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="@href">
|
<xsl:when test="@href">
|
||||||
<xsl:apply-templates
|
<xsl:apply-templates
|
||||||
select="document($wadl.path,$root)//wadl:resource[@id = substring-after(current()/@href,'#')]/wadl:method[@rax:id = current()/wadl:method/@href]"
|
select="document(concat('file:///', $wadl.path))//wadl:resource[@id = substring-after(current()/@href,'#')]/wadl:method[@rax:id = current()/wadl:method/@href]"
|
||||||
mode="preprocess">
|
mode="preprocess">
|
||||||
<xsl:with-param name="sectionId" select="ancestor::d:section/@xml:id"/>
|
<xsl:with-param name="sectionId" select="ancestor::d:section/@xml:id"/>
|
||||||
</xsl:apply-templates>
|
</xsl:apply-templates>
|
||||||
@@ -431,19 +477,19 @@
|
|||||||
<xsl:with-param name="path" select="substring-before($path,'#')"/>
|
<xsl:with-param name="path" select="substring-before($path,'#')"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:when test="contains($path,'\')">
|
<!-- <xsl:when test="contains($path,'\')"> -->
|
||||||
<xsl:call-template name="wadlPath">
|
<!-- <xsl:call-template name="wadlPath"> -->
|
||||||
<xsl:with-param name="path" select="substring-after($path,'\')"/>
|
<!-- <xsl:with-param name="path" select="substring-after($path,'\')"/> -->
|
||||||
</xsl:call-template>
|
<!-- </xsl:call-template> -->
|
||||||
</xsl:when>
|
<!-- </xsl:when> -->
|
||||||
<xsl:when test="contains($path,'/')">
|
<!-- <xsl:when test="contains($path,'/')"> -->
|
||||||
<xsl:call-template name="wadlPath">
|
<!-- <xsl:call-template name="wadlPath"> -->
|
||||||
<xsl:with-param name="path" select="substring-after($path,'/')"/>
|
<!-- <xsl:with-param name="path" select="substring-after($path,'/')"/> -->
|
||||||
</xsl:call-template>
|
<!-- </xsl:call-template> -->
|
||||||
</xsl:when>
|
<!-- </xsl:when> -->
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:value-of
|
<xsl:value-of
|
||||||
select="concat($project.build.directory, '/generated-resources/xml/xslt/',$path)"
|
select="concat($project.build.directory, '/generated-resources/xml/xslt',$docbook.partial.path.adjusted,$path)"
|
||||||
/>
|
/>
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
@@ -472,4 +518,18 @@
|
|||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template name="getUrl">
|
||||||
|
<xsl:param name="path" />
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="contains($path,'/')">
|
||||||
|
<xsl:value-of select="substring-before($path,'/')" />
|
||||||
|
<xsl:text>/</xsl:text>
|
||||||
|
<xsl:call-template name="getUrl">
|
||||||
|
<xsl:with-param name="path" select="substring-after($path,'/')" />
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise />
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
||||||
Reference in New Issue
Block a user