Mercurial > hg > nginx-site
comparison xslt/dirname.xslt @ 1085:c454373427ef
Regenerated.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Fri, 28 Feb 2014 20:12:47 +0400 |
parents | cd2698ea00ab |
children |
comparison
equal
deleted
inserted
replaced
1084:be1d72ba7e5f | 1085:c454373427ef |
---|---|
1 <?xml version="1.0" encoding="utf-8"?> | 1 <?xml version="1.0" encoding="utf-8"?> |
2 <!-- | |
3 Copyright (C) Igor Sysoev | |
4 Copyright (C) Nginx, Inc. | |
5 --> | |
6 | |
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | 7 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> |
3 | 8 |
4 <xsl:variable name="DIRNAME"> | |
5 <xsl:call-template name="dirname"> | |
6 <xsl:with-param select="$LINK" name="path"/> | |
7 </xsl:call-template> | |
8 </xsl:variable> | |
9 | 9 |
10 <xsl:template name="dirname"> | 10 <!-- return a dirname of an article link --> |
11 <xsl:param name="path"/> | |
12 | 11 |
13 <xsl:if test="contains($path, '/')"> | 12 <xsl:variable name="DIRNAME"> <xsl:call-template name="dirname"><xsl:with-param select="$LINK" name="path"/></xsl:call-template></xsl:variable> |
14 | 13 |
15 <xsl:value-of select=" substring-before($path, '/')"/> | 14 <xsl:template name="dirname"><xsl:param name="path"/> |
15 <xsl:if test="contains($path, '/')"> | |
16 <xsl:value-of select=" substring-before($path, '/') "/> | |
17 <xsl:text>/</xsl:text> | |
18 <xsl:call-template name="dirname"><xsl:with-param select="substring-after($path, '/')" name="path"/></xsl:call-template></xsl:if> | |
19 </xsl:template> | |
16 | 20 |
17 <xsl:text>/</xsl:text> | |
18 | 21 |
19 <xsl:call-template name="dirname"> | 22 <!-- return a path to the root of an article link, i.e., "../../.." --> |
20 <xsl:with-param select="substring-after($path, '/')" name="path"/> | |
21 </xsl:call-template> | |
22 </xsl:if> | |
23 </xsl:template> | |
24 | 23 |
25 <xsl:variable name="ROOT"> | 24 <xsl:variable name="ROOT"> <xsl:call-template name="root"><xsl:with-param name="path"> <xsl:value-of select=" substring($DIRNAME, 2) "/> </xsl:with-param></xsl:call-template></xsl:variable> |
26 <xsl:call-template name="root"> | |
27 <xsl:with-param name="path"> | |
28 <xsl:value-of select=" substring($DIRNAME, 2)"/> | |
29 </xsl:with-param> | |
30 </xsl:call-template> | |
31 </xsl:variable> | |
32 | 25 |
33 <xsl:template name="root"> | 26 <xsl:template name="root"><xsl:param name="path"/> |
34 <xsl:param name="path"/> | 27 <xsl:if test="contains($path, '/')"> |
35 | 28 <xsl:text>..</xsl:text> |
36 <xsl:if test="contains($path, '/')"> | 29 <xsl:if test="substring-after($path, '/')"> |
37 | |
38 <xsl:text>..</xsl:text> | |
39 | |
40 <xsl:if test="substring-after($path, '/')"> | |
41 | |
42 <xsl:text>/</xsl:text> | 30 <xsl:text>/</xsl:text> |
43 | 31 <xsl:call-template name="root"><xsl:with-param select="substring-after($path, '/')" name="path"/></xsl:call-template></xsl:if> |
44 <xsl:call-template name="root"> | 32 </xsl:if> |
45 <xsl:with-param select="substring-after($path, '/')" name="path"/> | 33 </xsl:template> |
46 </xsl:call-template> | |
47 </xsl:if> | |
48 </xsl:if> | |
49 </xsl:template> | |
50 | 34 |
51 </xsl:stylesheet> | 35 </xsl:stylesheet> |