changeset 604:b2db67ca29cc

Made a link to original relative.
author Ruslan Ermilov <ru@nginx.com>
date Fri, 20 Jul 2012 13:14:50 +0000
parents e0544f2c4a70
children bfdc7833085a
files GNUmakefile xsls/body.xsls xsls/link.xsls
diffstat 3 files changed, 15 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -23,10 +23,10 @@ endef
 define	XSLT
 	xmllint --noout --valid $2
 	xsltproc -o $3							\
-		$(shell f=`echo $2 | sed 's;^xml/[^/]*/;xml/en/;'`;	\
-		[ -f $$f ] && echo --stringparam ORIGIN "../$$f")	\
-		$(shell echo $4						\
-		| sed -e "s/\([^= ]*\)=\([^= ]*\)/--param \1 \"'\2'\"/g") \
+		$(shell f=`echo $2 | sed 's,^xml/,,;s,[^/]*/,en/,'`;	\
+		[ -f xml/$$f ] && echo --stringparam ORIGIN "$$f")	\
+		$(shell p="$4"; [ -n "$$p" ] &&				\
+		echo --stringparam $${p%%=*} $${p#*=})			\
 		$1 $2
 endef
 
--- a/xsls/body.xsls
+++ b/xsls/body.xsls
@@ -39,8 +39,10 @@ X:template body (lang) {
 
     <tr><td valign="top">
 
-        X:if "$ORIGIN and document($ORIGIN)/*/@rev and
-              (not(@rev) or @rev != document($ORIGIN)/*/@rev)" {
+        X:if "$ORIGIN and document(concat($XML, '/', $ORIGIN))/*/@rev and
+              (not(@rev) or
+              @rev != document(concat($XML, '/', $ORIGIN))/*/@rev)"
+        {
             <span>
 
             X:if "@lang = 'he'" { X:attribute "class" { X:text{ltr} } }
--- a/xsls/link.xsls
+++ b/xsls/link.xsls
@@ -8,7 +8,13 @@ X:stylesheet {
 X:template = "img" { <img src="{@href}"> !!; </img> }
 
 X:template = "origin" {
-    <a href="{document($ORIGIN)/*/@link}"> !!; </a>
+    <a>
+    X:attribute "href" {
+        !root(path = "$ORIGIN")
+        !{ concat(substring-before($ORIGIN, '.xml'), '.html') }
+    }
+    !!;
+    </a>
 }
 
 X:template = "link[@url]" {