]> rtime.felk.cvut.cz Git - edu/xsl.git/commitdiff
Imported version used in NST
authorMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 5 Mar 2009 08:47:45 +0000 (09:47 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 5 Mar 2009 08:47:45 +0000 (09:47 +0100)
Makefile [new file with mode: 0644]
getlinks.xsl [new file with mode: 0644]
nst.xsl [new file with mode: 0644]

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..3634e83
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,64 @@
+# To be included in other Makefile
+
+# TOP: relative path to BASEDIR
+ifndef TOP
+TOP=..
+endif
+export TOP
+
+# Destination filename
+ifndef FNAME
+FNAME=index.html
+endif
+
+# BASEDIR: absolute path calculated from TOP
+BASEDIR:=$(shell cd $(TOP); pwd)
+export BASEDIR
+
+RELATIVEDIR:=$(shell CUR=$$(pwd); cd $(TOP); RD=$${CUR\#$(BASEDIR)}; echo $${RD\#/})
+TARGETDIR:=$(BASEDIR)/www/$(RELATIVEDIR)
+export TARGETDIR
+
+ifndef HTML
+HTML:=$(FNAME)
+endif
+
+export SOURCE
+
+.PHONY: all clean local subdirs
+
+all: local subdirs
+
+clean:
+       rm -rf $(TARGETDIR)/*
+
+subdirs:
+       $(Q)$(foreach d,$(SUBDIRS),$(MAKE) -C $(d) &&) true
+
+ifndef V
+Q=@
+endif
+
+
+WWW_ROOT ?= $(TOP)
+WWW_ROOT := $(WWW_ROOT:%/=%)
+
+DOCBOOK_REFS_CMD=xsltproc --stringparam www.root $(WWW_ROOT) $(XSLTPROCFLAGS) $(BASEDIR)/xsl/getlinks.xsl $(SOURCE)
+DOCBOOK_REFS=$(wildcard $(shell $(DOCBOOK_REFS_CMD)))
+
+local: $(addprefix $(TARGETDIR)/,$(HTML) $(DOCBOOK_REFS))
+
+$(TARGETDIR)/$(HTML): $(SOURCE)
+       $(Q)mkdir -p $(dir $@)
+       $(Q)echo "  XSLTPROC $<"
+       $(Q)xsltproc --stringparam www.root $(WWW_ROOT) $(XSLTPROCFLAGS) $(BASEDIR)/xsl/nst.xsl $< > "$@"
+#      $(Q)$(MAKE) --no-print-directory $(addprefix $(TARGETDIR)/,$(DOCBOOK_REFS))
+
+
+# For copying other file from source (images, pfd, ...)
+$(TARGETDIR)/%: %
+       $(Q)mkdir -p $(dir $@);\
+           if [ ! -d "$<" ]; then \
+               echo "  CP       $<";\
+               cp $< $@; \
+           fi
diff --git a/getlinks.xsl b/getlinks.xsl
new file mode 100644 (file)
index 0000000..9df3539
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version='1.0'?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:date="http://exslt.org/dates-and-times"
+               xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0"
+               exclude-result-prefixes="date"
+                version="1.0">
+
+  <!-- Print ulink parameters (to use by processing tools e.g. copy linked PDFs to web) -->
+  <xsl:template match="ulink">
+    <xsl:value-of select="@url"/>
+    <xsl:text>
+    </xsl:text>
+  </xsl:template>
+  <xsl:template match="imagedata">
+    <xsl:value-of select="@fileref"/>
+    <xsl:text>
+    </xsl:text>
+  </xsl:template>
+  <xsl:template match="inlinegraphic">
+    <xsl:value-of select="@fileref"/>
+    <xsl:text>
+    </xsl:text>
+  </xsl:template>
+
+  <xsl:template match="text()">
+  </xsl:template>
+
+  <xsl:output method="text" encoding="UTF-8" />
+</xsl:stylesheet>
diff --git a/nst.xsl b/nst.xsl
new file mode 100644 (file)
index 0000000..4a0e62e
--- /dev/null
+++ b/nst.xsl
@@ -0,0 +1,131 @@
+<?xml version='1.0'?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:date="http://exslt.org/dates-and-times"
+               xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0"
+               exclude-result-prefixes="date"
+                version="1.0">
+  
+  <!-- If you have /etc/xml/catalog setup properly, this woun't fetch .xsl from internet. -->
+  <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"/>
+  <xsl:param name="www.root" select="."/>
+  <xsl:param name="no.titlepage" select="0"/>
+  <xsl:param name="section.autolabel" select="1"></xsl:param>
+  <!-- <xsl:param name="img.src.path">resources/</xsl:param>-->
+
+  <xsl:param name="local.l10n.xml" select="document('')"/>
+  <l:i18n>
+    <l:l10n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" language="cs" english-language-name="Czech">
+      <l:gentext key="LastChanged" text="Poslední změna"/>
+      <l:context name="datetime"><l:template name="format" text="A d. B Y"/></l:context>
+    </l:l10n>
+    <l:l10n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" language="en" english-language-name="English">
+      <l:gentext key="LastChanged" text="Last changed"/>
+      <l:context name="datetime"><l:template name="format" text="A, B d, Y"/></l:context>
+    </l:l10n>
+  </l:i18n>
+
+  <xsl:template name="user.head.content">  
+    <meta name="date">  
+      <xsl:attribute name="content">  
+        <xsl:call-template name="datetime.format">  
+          <xsl:with-param name="date" select="date:date-time()"/> 
+          <xsl:with-param name="format" select="'Y-m-d'"/>
+        </xsl:call-template>
+      </xsl:attribute>
+    </meta>
+    <xsl:call-template name="output.html.stylesheets">
+      <xsl:with-param name="stylesheets" select="concat($www.root, '/cv.css')"/>
+    </xsl:call-template>
+    <xsl:call-template name="output.html.stylesheets">
+      <xsl:with-param name="stylesheets" select="concat($www.root, '/styl.css')"/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template name="last.change">
+    <p><strong><xsl:call-template name="gentext">
+      <xsl:with-param name="key" select="'LastChanged'"/>
+      </xsl:call-template>: </strong>
+      <xsl:call-template name="datetime.format">  
+       <xsl:with-param name="date" select="date:date-time()"/> 
+       <xsl:with-param name="format">
+         <xsl:call-template name="gentext.template">
+           <xsl:with-param name="context" select="'datetime'"/>
+           <xsl:with-param name="name" select="'format'"/>
+         </xsl:call-template>
+        </xsl:with-param>
+      <xsl:with-param name="padding" select="0"/>
+    </xsl:call-template>
+    </p>
+  </xsl:template>
+
+  <xsl:template name="article.orig">
+    <div class="{name(.)}">
+      <xsl:call-template name="language.attribute"/>
+      <xsl:if test="$generate.id.attributes != 0">
+        <xsl:attribute name="id">
+          <xsl:call-template name="object.id"/>
+        </xsl:attribute>
+      </xsl:if>
+
+      <!-- We don't want titles etc. in the homepage -->
+      <xsl:if test="not($no.titlepage)">
+       <xsl:call-template name="article.titlepage"/>
+       
+       <xsl:variable name="toc.params">
+         <xsl:call-template name="find.path.params">
+           <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
+         </xsl:call-template>
+       </xsl:variable>
+       
+       <xsl:call-template name="make.lots">
+         <xsl:with-param name="toc.params" select="$toc.params"/>
+         <xsl:with-param name="toc">
+          <xsl:call-template name="component.toc">
+           <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
+         </xsl:call-template>
+        </xsl:with-param>
+       </xsl:call-template>
+       
+       <xsl:call-template name="last.change" />
+      </xsl:if>
+
+      <xsl:apply-templates/>
+      <xsl:call-template name="process.footnotes"/>
+    </div>
+  </xsl:template>
+
+  <xsl:template match="article">
+    <div id="main">
+      <div id="head">
+       <h1><a href="{$www.root}">Navrhování systémů s výpočetní technikou</a></h1>
+      </div>
+      <div id="menu">
+       <ul>
+         <li><a href="{$www.root}/prednasky/index.html" title="Přednášky">Přednášky</a></li>
+         <li><a href="{$www.root}/cviceni/index.html" title="Cvičení">Cvičení</a></li>
+         <!-- Lang: <xsl:value-of select="$l10n.xml/l:i18n/l:l10n[@language='cs']/@english-language-name"/> -->
+       </ul>
+       <!-- <div class="ico"> -->
+       <!-- <a href="http://dce.felk.cvut.cz" title="Katedra řídicí techniky" rel="external"><img src="img/dce.gif" width="28" height="28" alt="Katedra řídicí techniky" /></a> -->
+       <!-- <a href="http://www.fel.cvut.cz" title="FEL ČVUT" rel="external"><img src="img/lev.gif" width="37" height="28" alt="FEL ČVUT" /></a> -->
+       <!-- </div>   -->
+      </div>
+
+      <xsl:call-template name="article.orig"/>
+      <div id="tail">
+       <p>Všechny připomínky k předmětu, obsahu stránek, objevené
+       chyby v ukázkových programech apod. adresujte na autory:</p>
+
+<!--   <div style="float: right; position: relative; top: 2ex;"> -->
+<!--     <a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a> -->
+<!--   </div> -->
+
+       <ul>
+         <li>sojkam1 (at) fel.cvut.cz</li>
+        </ul>
+      </div>
+    </div>
+  </xsl:template>
+
+  <xsl:output method="xml" encoding="UTF-8" />
+</xsl:stylesheet>