Skip to content

Commit

Permalink
Update: Add versioning.
Browse files Browse the repository at this point in the history
  • Loading branch information
sttk committed Dec 20, 2019
1 parent 83d9f3e commit 5281c6e
Show file tree
Hide file tree
Showing 27 changed files with 223 additions and 36 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# [@xslet/xslutil](https://github.com/xslet/xslutil)
# [@xslet/xslutil](https://github.com/xslet/xslutil) ver.0.1

A set of utilities for XSLT programs on Web browsers.

Expand Down
6 changes: 6 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>

<project name="xslutil" basedir="." default="build">
<!-- These properties are used by merge processes -->
<property name="product" value="xslutil.xsl"/>
<property name="version" value="0.1"/>
<property name="copyright" value="Copyright (C) xslet@github"/>
<property name="license" value="MIT License"/>

<property name="app.name" value="${ant.project.name}"/>
<property name="dep.saxon.version" value="9-9-1-5J"/>
<property name="dep.tomcat.version" value="9.0.27"/>
Expand Down
64 changes: 64 additions & 0 deletions build_aux/xsl/merge-for-dist.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,74 @@
xmlns:xsx="dummy-ns" exclude-result-prefixes="xsx"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:param name="product">
<xsl:for-each select="document('../../build.xml', /)/project">
<xsl:value-of select="property[@name='product']/@value"/>
</xsl:for-each>
</xsl:param>
<xsl:param name="version">
<xsl:for-each select="document('../../build.xml', /)/project">
<xsl:value-of select="property[@name='version']/@value"/>
</xsl:for-each>
</xsl:param>
<xsl:param name="copyright">
<xsl:for-each select="document('../../build.xml', /)/project">
<xsl:value-of select="property[@name='copyright']/@value"/>
</xsl:for-each>
</xsl:param>
<xsl:param name="license">
<xsl:for-each select="document('../../build.xml', /)/project">
<xsl:value-of select="property[@name='license']/@value"/>
</xsl:for-each>
</xsl:param>

<xsl:strip-space elements="*"/>
<xsl:namespace-alias result-prefix="xsl" stylesheet-prefix="xsx"/>

<xsl:template match="/">
<xsl:call-template name="merge">
<xsl:with-param name="destfile" select="'xslutil.xsl'"/>
<xsl:with-param name="srcdir" select="'../../src/xsl'"/>
<xsl:with-param name="libdir" select="'../../src/xsl/lib'"/>
<xsl:with-param name="extdir" select="'../../src/xsl/ext'"/>
</xsl:call-template>
</xsl:template>

<xsl:template name="merge">
<xsl:param name="destfile"/>
<xsl:param name="srcdir"/>
<xsl:param name="libdir"/>
<xsl:param name="extdir"/>

<xsl:result-document href="{$destfile}">

<xsl:comment>
<xsl:text> </xsl:text>
<xsl:value-of select="$product"/>
<xsl:text> v</xsl:text>
<xsl:value-of select="$version"/>
<xsl:text>. </xsl:text>
<xsl:value-of select="$copyright"/>
<xsl:text>. </xsl:text>
<xsl:value-of select="$license"/>
<xsl:text> </xsl:text>
</xsl:comment>

<xsx:stylesheet version="1.0">

<xsl:merge>
<xsl:merge-source for-each-source="uri-collection($srcdir)"
select="xsl:stylesheet/xsl:import">
<xsl:merge-key select="href"/>
</xsl:merge-source>
<xsl:merge-source for-each-source="uri-collection($libdir)"
select="xsl:stylesheet/xsl:import">
<xsl:merge-key select="href"/>
</xsl:merge-source>
<xsl:merge-source for-each-source="uri-collection($extdir)"
select="xsl:stylesheet/xsl:import">
<xsl:merge-key select="href"/>
</xsl:merge-source>
<xsl:merge-action>
<xsl:copy-of select="current-merge-group()"/>
</xsl:merge-action>
Expand All @@ -37,6 +83,14 @@
select="xsl:stylesheet/xsl:param">
<xsl:merge-key select="name"/>
</xsl:merge-source>
<xsl:merge-source for-each-source="uri-collection($libdir)"
select="xsl:stylesheet/xsl:param">
<xsl:merge-key select="name"/>
</xsl:merge-source>
<xsl:merge-source for-each-source="uri-collection($extdir)"
select="xsl:stylesheet/xsl:param">
<xsl:merge-key select="name"/>
</xsl:merge-source>
<xsl:merge-action>
<xsl:copy-of select="current-merge-group()"/>
</xsl:merge-action>
Expand All @@ -48,6 +102,16 @@
<xsl:merge-key select="name|match"/>
<xsl:merge-key select="mode"/>
</xsl:merge-source>
<xsl:merge-source for-each-source="uri-collection($libdir)"
select="xsl:stylesheet/xsl:template">
<xsl:merge-key select="name|match"/>
<xsl:merge-key select="mode"/>
</xsl:merge-source>
<xsl:merge-source for-each-source="uri-collection($extdir)"
select="xsl:stylesheet/xsl:template">
<xsl:merge-key select="name|match"/>
<xsl:merge-key select="mode"/>
</xsl:merge-source>
<xsl:merge-action>
<xsl:copy-of select="current-merge-group()"/>
</xsl:merge-action>
Expand Down
75 changes: 72 additions & 3 deletions build_aux/xsl/merge-for-doc.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,69 @@
xmlns:xsx="dummy-ns" exclude-result-prefixes="xsx"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:param name="product">
<xsl:for-each select="document('../../build.xml', /)/project">
<xsl:value-of select="property[@name='product']/@value"/>
</xsl:for-each>
</xsl:param>
<xsl:param name="version">
<xsl:for-each select="document('../../build.xml', /)/project">
<xsl:value-of select="property[@name='version']/@value"/>
</xsl:for-each>
</xsl:param>
<xsl:param name="copyright">
<xsl:for-each select="document('../../build.xml', /)/project">
<xsl:value-of select="property[@name='copyright']/@value"/>
</xsl:for-each>
</xsl:param>
<xsl:param name="license">
<xsl:for-each select="document('../../build.xml', /)/project">
<xsl:value-of select="property[@name='license']/@value"/>
</xsl:for-each>
</xsl:param>

<xsl:strip-space elements="*"/>
<xsl:namespace-alias result-prefix="xsl" stylesheet-prefix="xsx"/>

<xsl:template match="/">
<xsl:call-template name="merge">
<xsl:with-param name="destfile" select="'api/xslutil.xml'"/>
<xsl:with-param name="srcdir" select="'../../src/xsl'"/>
<xsl:with-param name="libdir" select="'../../src/xsl/lib'"/>
<xsl:with-param name="extdir" select="'../../src/xsl/ext'"/>
</xsl:call-template>
</xsl:template>

<xsl:template name="merge">
<xsl:param name="destfile"/>
<xsl:param name="srcdir"/>
<xsl:param name="libdir"/>
<xsl:param name="extdir"/>

<xsl:result-document href="{$destfile}">
<xsl:processing-instruction name="xml-stylesheet">type="application/xml" href="xsldoc/xsldoc.xsl"</xsl:processing-instruction>

<xsl:for-each select="collection(concat($srcdir, '?select=_summary.xsl'))">
<xsl:comment><xsl:value-of select="xsl:stylesheet/preceding-sibling::comment()[1]"/></xsl:comment>
</xsl:for-each>
<xsl:comment><!-- The file status comment -->
<xsl:text> </xsl:text>
<xsl:value-of select="$product"/>
<xsl:text> v</xsl:text>
<xsl:value-of select="$version"/>
<xsl:text>. </xsl:text>
<xsl:value-of select="$copyright"/>
<xsl:text>. </xsl:text>
<xsl:value-of select="$license"/>
<xsl:text> </xsl:text>
</xsl:comment>

<xsl:comment><!-- The file summary comment -->
<xsl:value-of select="concat('** ', $product, ' ver', $version, ' - API Document&#10;')"/>
<xsl:for-each select="collection(concat($srcdir, '?select=**.xsl'))">
<xsl:value-of select="xsl:stylesheet/preceding-sibling::comment()[1]"/>
</xsl:for-each>
<xsl:value-of select="'&#10;'"/>
<xsl:value-of select="concat('** ', $copyright, '&#10;')"/>
<xsl:value-of select="concat('** ', $license, '&#10;')"/>
</xsl:comment>

<xsx:stylesheet version="1.0">

Expand All @@ -33,6 +76,14 @@
select="xsl:stylesheet/xsl:import|xsl:stylesheet/comment()[following-sibling::*[1]/name() = 'xsl:import']">
<xsl:merge-key select="href"/>
</xsl:merge-source>
<xsl:merge-source for-each-source="uri-collection($libdir)"
select="xsl:stylesheet/xsl:import|xsl:stylesheet/comment()[following-sibling::*[1]/name() = 'xsl:import']">
<xsl:merge-key select="href"/>
</xsl:merge-source>
<xsl:merge-source for-each-source="uri-collection($extdir)"
select="xsl:stylesheet/xsl:import|xsl:stylesheet/comment()[following-sibling::*[1]/name() = 'xsl:import']">
<xsl:merge-key select="href"/>
</xsl:merge-source>
<xsl:merge-action>
<xsl:copy-of select="current-merge-group()"/>
</xsl:merge-action>
Expand All @@ -43,6 +94,14 @@
select="xsl:stylesheet/xsl:param|xsl:stylesheet/comment()[following-sibling::*[1]/name() = 'xsl:param']">
<xsl:merge-key select="name"/>
</xsl:merge-source>
<xsl:merge-source for-each-source="uri-collection($libdir)"
select="xsl:stylesheet/xsl:param|xsl:stylesheet/comment()[following-sibling::*[1]/name() = 'xsl:param']">
<xsl:merge-key select="name"/>
</xsl:merge-source>
<xsl:merge-source for-each-source="uri-collection($extdir)"
select="xsl:stylesheet/xsl:param|xsl:stylesheet/comment()[following-sibling::*[1]/name() = 'xsl:param']">
<xsl:merge-key select="name"/>
</xsl:merge-source>
<xsl:merge-action>
<xsl:copy-of select="current-merge-group()"/>
</xsl:merge-action>
Expand All @@ -54,6 +113,16 @@
<xsl:merge-key select="name|match"/>
<xsl:merge-key select="mode"/>
</xsl:merge-source>
<xsl:merge-source for-each-source="uri-collection($libdir)"
select="xsl:stylesheet/xsl:template|xsl:stylesheet/comment()[following-sibling::*[1]/name() = 'xsl:template']">
<xsl:merge-key select="name|match"/>
<xsl:merge-key select="mode"/>
</xsl:merge-source>
<xsl:merge-source for-each-source="uri-collection($extdir)"
select="xsl:stylesheet/xsl:template|xsl:stylesheet/comment()[following-sibling::*[1]/name() = 'xsl:template']">
<xsl:merge-key select="name|match"/>
<xsl:merge-key select="mode"/>
</xsl:merge-source>
<xsl:merge-action>
<xsl:copy-of select="current-merge-group()"/>
</xsl:merge-action>
Expand Down
24 changes: 20 additions & 4 deletions build_aux/xsl/merge-for-test.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,26 @@
<xsl:template match="/">
<xsl:call-template name="merge">
<xsl:with-param name="destfile" select="'unit.test.xsl'"/>
<xsl:with-param name="srcdir" select="'../../src/xsl'"/>
<xsl:with-param name="libdir" select="'../../src/xsl/lib'"/>
<xsl:with-param name="extdir" select="'../../src/xsl/ext'"/>
</xsl:call-template>
</xsl:template>

<xsl:template name="merge">
<xsl:param name="destfile"/>
<xsl:param name="srcdir"/>
<xsl:param name="libdir"/>
<xsl:param name="extdir"/>

<xsl:result-document href="{$destfile}">
<xsx:stylesheet version="1.0">

<xsl:merge>
<xsl:merge-source for-each-source="uri-collection($srcdir)"
<xsl:merge-source for-each-source="uri-collection($libdir)"
select="xsl:stylesheet/xsl:import">
<xsl:merge-key select="href"/>
</xsl:merge-source>
<xsl:merge-source for-each-source="uri-collection($extdir)"
select="xsl:stylesheet/xsl:import">
<xsl:merge-key select="href"/>
</xsl:merge-source>
Expand All @@ -35,7 +42,11 @@
</xsl:merge>

<xsl:merge>
<xsl:merge-source for-each-source="uri-collection($srcdir)"
<xsl:merge-source for-each-source="uri-collection($libdir)"
select="xsl:stylesheet/xsl:param">
<xsl:merge-key select="name"/>
</xsl:merge-source>
<xsl:merge-source for-each-source="uri-collection($extdir)"
select="xsl:stylesheet/xsl:param">
<xsl:merge-key select="name"/>
</xsl:merge-source>
Expand All @@ -47,7 +58,12 @@
</xsl:merge>

<xsl:merge>
<xsl:merge-source for-each-source="uri-collection($srcdir)"
<xsl:merge-source for-each-source="uri-collection($libdir)"
select="xsl:stylesheet/xsl:template">
<xsl:merge-key select="name|match"/>
<xsl:merge-key select="mode"/>
</xsl:merge-source>
<xsl:merge-source for-each-source="uri-collection($extdir)"
select="xsl:stylesheet/xsl:template">
<xsl:merge-key select="name|match"/>
<xsl:merge-key select="mode"/>
Expand Down
32 changes: 22 additions & 10 deletions build_aux/xsl/xsldoc/xsldoc.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.xsldoc = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
'use strict';

function printPageTitle() {
var fpath = location.href;
var index = fpath.lastIndexOf('/');
var fname = (index < 0) ? fpath : fpath.substring(index + 1);
if (fname.slice(-4) === '.xml') {
fname = fname.slice(0, -4) + '.xsl';
function setupPageTitle() {
var pageDesc = document.querySelector('div.comment.page-desc');

var pageDescHtml = pageDesc.innerHTML;
pageDescHtml = pageDescHtml.replace(/^(<br>)+/, '');

var foundIndex = pageDescHtml.indexOf('<br>');
if (foundIndex < 0) {
if (pageDescHtml) {
document.title = pageDescHtml;
pageDesc.innerHTML = '';
}
return;
}
var title = fname + ' - API Document';
document.querySelector('h1').textContent = title;
document.title = title;

var fileTitle = pageDescHtml.slice(0, foundIndex).trim();
var fileSummary = pageDescHtml.slice(foundIndex + '<br>'.length).trim();
fileSummary = fileSummary.replace(/^(<br>)+/, '');

document.title = fileTitle;
document.querySelector('h1').textContent = fileTitle;
document.querySelector('div.comment.page-desc').innerHTML = fileSummary;
}

module.exports = {
printPageTitle: printPageTitle,
setupPageTitle: setupPageTitle,
};

},{}]},{},[1])(1)
Expand Down
2 changes: 1 addition & 1 deletion build_aux/xsl/xsldoc/xsldoc.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build_aux/xsl/xsldoc/xsldoc.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion build_aux/xsl/xsldoc/xsldoc.xsl

Large diffs are not rendered by default.

Loading

0 comments on commit 5281c6e

Please sign in to comment.