author | lorewang |
Mon, 22 Nov 2010 10:56:31 +0800 | |
changeset 700 | c22eff170fac |
parent 624 | f70b728ea30c |
permissions | -rw-r--r-- |
624
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
1 |
<?xml version="1.0"?> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
2 |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
3 |
<!--Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
4 |
All rights reserved. |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
5 |
This component and the accompanying materials are made available |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
6 |
under the terms of the License "Eclipse Public License v1.0" |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
7 |
which accompanies this distribution, and is available |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
8 |
at the URL "http://www.eclipse.org/legal/epl-v10.html". |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
9 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
10 |
Initial Contributors: |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
11 |
Nokia Corporation - initial contribution. |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
12 |
Contributors: |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
13 |
Description: |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
14 |
XSLT module which contains named templates which process file paths |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
15 |
--> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
16 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
17 |
<xsl:template name="lastbefore"><xsl:param name="string"/><xsl:param name="substr" select="'/'"/> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
18 |
<xsl:if test="contains($string,$substr)"> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
19 |
<xsl:value-of select="substring-before($string,$substr)"/> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
20 |
<xsl:if test="contains(substring-after($string,$substr),$substr)"> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
21 |
<xsl:value-of select="$substr"/> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
22 |
</xsl:if> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
23 |
<xsl:call-template name="lastbefore"> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
24 |
<xsl:with-param name="string" select="substring-after($string,$substr)"/> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
25 |
<xsl:with-param name="substr" select="$substr"/> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
26 |
</xsl:call-template> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
27 |
</xsl:if> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
28 |
</xsl:template> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
29 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
30 |
<xsl:template name="joinpath"><xsl:param name="file"/><xsl:param name="rel"/> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
31 |
<xsl:choose> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
32 |
<xsl:when test="(contains($rel,'://') and not(contains(substring-before($rel,'://'),'/'))) or starts-with($rel,'/')"> <!-- absolute URI or absolute path--> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
33 |
<xsl:value-of select="$rel"/> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
34 |
</xsl:when> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
35 |
<xsl:otherwise> <!-- relative link --> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
36 |
<xsl:call-template name="reducepath"> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
37 |
<xsl:with-param name="file"> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
38 |
<xsl:call-template name="lastbefore"> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
39 |
<xsl:with-param name="string" select="$file"/> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
40 |
</xsl:call-template> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
41 |
<xsl:text>/</xsl:text> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
42 |
<xsl:value-of select="$rel"/> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
43 |
</xsl:with-param> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
44 |
</xsl:call-template> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
45 |
</xsl:otherwise> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
46 |
</xsl:choose> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
47 |
</xsl:template> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
48 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
49 |
<xsl:template name="reducepath"><xsl:param name="file"/> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
50 |
<xsl:call-template name="reducedotdotpath"> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
51 |
<xsl:with-param name="file"> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
52 |
<xsl:call-template name="reducedotpath"> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
53 |
<xsl:with-param name="file" select="$file"/> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
54 |
</xsl:call-template> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
55 |
</xsl:with-param> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
56 |
</xsl:call-template> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
57 |
</xsl:template> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
58 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
59 |
<xsl:template name="reducedotdotpath"><xsl:param name="file"/> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
60 |
<xsl:variable name="pre"> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
61 |
<xsl:call-template name="lastbefore"> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
62 |
<xsl:with-param name="string" select="substring-before($file,'/../')"/> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
63 |
</xsl:call-template> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
64 |
</xsl:variable> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
65 |
<xsl:choose> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
66 |
<xsl:when test="starts-with($file,'../')"> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
67 |
<xsl:text>../</xsl:text> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
68 |
<xsl:call-template name="reducedotdotpath"> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
69 |
<xsl:with-param name="file" select="substring($file,4)"/> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
70 |
</xsl:call-template> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
71 |
</xsl:when> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
72 |
<xsl:when test="contains($file,'/../') and $pre='' and not(starts-with($file,'/'))"> <!-- if file is a relative path and the dotdots go up to the top dir, don't start with a slash --> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
73 |
<xsl:call-template name="reducepath"> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
74 |
<xsl:with-param name="file" select="substring-after($file,'/../')"/> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
75 |
</xsl:call-template> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
76 |
</xsl:when> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
77 |
<xsl:when test="contains($file,'/../')"> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
78 |
<xsl:call-template name="reducepath"> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
79 |
<xsl:with-param name="file" select="concat($pre,'/',substring-after($file,'/../'))"/> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
80 |
</xsl:call-template> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
81 |
</xsl:when> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
82 |
<xsl:otherwise><xsl:value-of select="$file"/></xsl:otherwise> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
83 |
</xsl:choose> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
84 |
</xsl:template> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
85 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
86 |
<xsl:template name="reducedotpath"><xsl:param name="file"/> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
87 |
<xsl:choose> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
88 |
<xsl:when test="starts-with($file,'./')"> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
89 |
<xsl:call-template name="reducedotpath"> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
90 |
<xsl:with-param name="file" select="substring($file,3)"/> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
91 |
</xsl:call-template> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
92 |
</xsl:when> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
93 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
94 |
<xsl:when test="contains($file,'/./')"> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
95 |
<xsl:call-template name="reducepath"> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
96 |
<xsl:with-param name="file"> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
97 |
<xsl:value-of select="substring-before($file,'/./')"/> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
98 |
<xsl:text>/</xsl:text> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
99 |
<xsl:value-of select="substring-after($file,'/./')"/> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
100 |
</xsl:with-param> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
101 |
</xsl:call-template> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
102 |
</xsl:when> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
103 |
<xsl:when test="substring($file,string-length($file) - 1) = '/.'"> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
104 |
<xsl:value-of select="substring($file,1,string-length($file) - 2)"/> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
105 |
</xsl:when> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
106 |
<xsl:otherwise><xsl:value-of select="$file"/></xsl:otherwise> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
107 |
</xsl:choose> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
108 |
</xsl:template> |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
109 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
110 |
</xsl:stylesheet> |