summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2017-02-12 12:48:46 +0100
committerAdrian Kummerlaender2017-02-12 12:48:46 +0100
commitaa8a7bed75ab213ec78a89b84f1c4c2ca34cee8a (patch)
treead5312e2258f51945c656775e1b45b61b4898745
parent490963c1550efffe046179ced9b39573185e3e1d (diff)
downloadtree.kummerlaender.eu-aa8a7bed75ab213ec78a89b84f1c4c2ca34cee8a.tar
tree.kummerlaender.eu-aa8a7bed75ab213ec78a89b84f1c4c2ca34cee8a.tar.gz
tree.kummerlaender.eu-aa8a7bed75ab213ec78a89b84f1c4c2ca34cee8a.tar.bz2
tree.kummerlaender.eu-aa8a7bed75ab213ec78a89b84f1c4c2ca34cee8a.tar.lz
tree.kummerlaender.eu-aa8a7bed75ab213ec78a89b84f1c4c2ca34cee8a.tar.xz
tree.kummerlaender.eu-aa8a7bed75ab213ec78a89b84f1c4c2ca34cee8a.tar.zst
tree.kummerlaender.eu-aa8a7bed75ab213ec78a89b84f1c4c2ca34cee8a.zip
Implement showcase start page
-rw-r--r--source/01_raw/showcase.xsl33
-rw-r--r--source/02_data/digest.xsl38
-rw-r--r--source/99_result/branches.xsl3
-rw-r--r--source/99_result/start.xsl46
-rw-r--r--utility/master.xsl2
5 files changed, 120 insertions, 2 deletions
diff --git a/source/01_raw/showcase.xsl b/source/01_raw/showcase.xsl
new file mode 100644
index 0000000..e087c03
--- /dev/null
+++ b/source/01_raw/showcase.xsl
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+>
+
+<xsl:include href="[utility/datasource.xsl]"/>
+
+<xsl:variable name="meta">
+ <datasource type="main" mode="xpath" source="$source_tree/directory[@name = '00_content']/directory[@name = 'showcase']/file" target="links"/>
+ <datasource type="support" mode="xpath" source="$source_tree/directory[@name = '00_content']/directory[@name = 'tree']/directory" target="files"/>
+ <target mode="plain" value="showcase.xml"/>
+</xsl:variable>
+
+<xsl:template match="directory | file" mode="serialize">
+ <xsl:apply-templates select="parent::directory" mode="serialize"/>
+ <xsl:text>/</xsl:text>
+ <xsl:value-of select="@name"/>
+</xsl:template>
+
+<xsl:template match="file" mode="resolve">
+ <xsl:variable name="path">
+ <xsl:apply-templates select="." mode="serialize"/>
+ </xsl:variable>
+
+ <entry handle="{$path}"/>
+</xsl:template>
+
+<xsl:template match="links/file/full">
+ <xsl:apply-templates select="/datasource/files//file[full/text() = current()/text()]" mode="resolve"/>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/source/02_data/digest.xsl b/source/02_data/digest.xsl
new file mode 100644
index 0000000..34eaae7
--- /dev/null
+++ b/source/02_data/digest.xsl
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xalan="http://xml.apache.org/xalan"
+ xmlns:InputXSLT="function.inputxslt.application"
+ exclude-result-prefixes="xalan InputXSLT"
+>
+
+<xsl:include href="[utility/datasource.xsl]"/>
+
+<xsl:variable name="meta">
+ <datasource type="main" mode="full" source="01_raw/tree.xml" target="tree"/>
+ <target mode="plain" value="digest.xml"/>
+</xsl:variable>
+
+<xsl:template match="branch | leaf" mode="serialize">
+ <xsl:apply-templates select="parent::branch" mode="serialize"/>
+ <xsl:text>/</xsl:text>
+ <xsl:value-of select="@name"/>
+</xsl:template>
+
+<xsl:template match="tree//leaf">
+ <xsl:variable name="path">
+ <xsl:apply-templates select="." mode="serialize"/>
+ </xsl:variable>
+
+ <entry handle="{$path}">
+ <title>
+ <xsl:value-of select="title"/>
+ </title>
+ <digest size="{string-length(content/p[normalize-space(.)][1])}">
+ <xsl:copy-of select="content/p[normalize-space(.)][1]/node()"/>
+ </digest>
+ </entry>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/source/99_result/branches.xsl b/source/99_result/branches.xsl
index 86467ef..9b79739 100644
--- a/source/99_result/branches.xsl
+++ b/source/99_result/branches.xsl
@@ -12,6 +12,7 @@
<xsl:variable name="meta">
<datasource type="main" mode="iterate" source="02_data/branches.xml" target="branch"/>
+ <datasource type="support" mode="full" source="02_data/digest.xml" target="digest"/>
<datasource type="support" mode="full" source="03_meta/meta.xml" target="meta"/>
<target mode="xpath" value="concat($datasource/branch/entry/@handle, '/index.html')"/>
</xsl:variable>
@@ -35,7 +36,7 @@
<div class="columns">
<ul class="prettylist">
- <xsl:apply-templates select="branches/node">
+ <xsl:apply-templates select="digest/node">
<xsl:sort select="digest/@size" data-type="number" order="descending"/>
</xsl:apply-templates>
diff --git a/source/99_result/start.xsl b/source/99_result/start.xsl
new file mode 100644
index 0000000..00572f7
--- /dev/null
+++ b/source/99_result/start.xsl
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+>
+
+<xsl:include href="[utility/master.xsl]"/>
+<xsl:include href="[utility/xhtml.xsl]"/>
+
+<xsl:variable name="meta">
+ <datasource type="main" mode="full" source="01_raw/showcase.xml" target="showcase"/>
+ <datasource type="support" mode="full" source="02_data/digest.xml" target="digest"/>
+ <datasource type="support" mode="full" source="03_meta/meta.xml" target="meta"/>
+ <target mode="plain" value="index.html"/>
+</xsl:variable>
+
+<xsl:template name="title-text">Start</xsl:template>
+
+<xsl:template match="digest/entry" mode="digest">
+ <li>
+ <em>ยป</em>
+ <a href="{@handle}/index.html">
+ <strong><xsl:value-of select="title"/></strong>
+ <p>
+ <xsl:apply-templates select="digest/node()" mode="xhtml"/>
+ </p>
+ </a>
+ </li>
+</xsl:template>
+
+<xsl:template match="showcase/entry">
+ <xsl:apply-templates select="/datasource/digest/entry[@handle = current()/@handle]" mode="digest"/>
+</xsl:template>
+
+<xsl:template match="showcase">
+ <h3>Representative subset of nodes</h3>
+
+ <div class="columns">
+ <ul class="prettylist">
+ <xsl:apply-templates select="entry"/>
+ </ul>
+ </div>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/utility/master.xsl b/utility/master.xsl
index 80bfccd..5d5907e 100644
--- a/utility/master.xsl
+++ b/utility/master.xsl
@@ -59,7 +59,7 @@
</div>
<div id="footer" class="center border_top">
- <a href="/projects/xslt/static_xslt/">Made with XSLT</a>
+ <a href="/projects/xslt/">Made with XSLT</a>
<ul class="buttonlist">
<li>