Mercurial > dive4elements > river
annotate artifacts/contrib/inline-dc-attribute.xsl @ 8495:dc0351c5d098
Artifact-server config in release script: remove installation specific defaults and give the possibility to overwrite any config-file.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 04 Dec 2014 18:15:05 +0100 |
parents | 5aa05a7a34b7 |
children |
rev | line source |
---|---|
5499
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
1 <?xml version="1.0" encoding="UTF-8"?> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
2 <!-- |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
3 inline-dc-attribute.xsl |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
4 ======================= |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
5 Transforms datacage templates from: |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
6 |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
7 <foo> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
8 <dc:element name="bar" value="${baz}"/> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
9 <dc:element name="bla" value="${blub}-${urgs}"/> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
10 </foo> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
11 |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
12 to: |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
13 |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
14 <foo bar="{$bar} bla="{$blub}-{$urgs}/> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
15 --> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
16 <xsl:stylesheet version="1.0" |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
17 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
18 xmlns:dc="http://www.intevation.org/2011/Datacage"> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
19 |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
20 <xsl:output method="xml" encoding="UTF-8" indent="yes"/> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
21 |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
22 <xsl:template name="string-replace-all"> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
23 <xsl:param name="text"/> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
24 <xsl:param name="replace"/> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
25 <xsl:param name="by"/> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
26 <xsl:choose> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
27 <xsl:when test="contains($text, $replace)"> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
28 <xsl:value-of select="substring-before($text,$replace)"/> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
29 <xsl:value-of select="$by"/> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
30 <xsl:call-template name="string-replace-all"> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
31 <xsl:with-param name="text" select="substring-after($text,$replace)"/> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
32 <xsl:with-param name="replace" select="$replace"/> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
33 <xsl:with-param name="by" select="$by"/> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
34 </xsl:call-template> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
35 </xsl:when> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
36 <xsl:otherwise> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
37 <xsl:value-of select="$text"/> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
38 </xsl:otherwise> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
39 </xsl:choose> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
40 </xsl:template> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
41 |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
42 <xsl:template |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
43 match="node()[count(dc:attribute) > 0 and namespace-uri() != 'http://www.intevation.org/2011/Datacage']"> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
44 <xsl:copy> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
45 <xsl:for-each select="./dc:attribute"> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
46 <xsl:attribute name="{@name}"> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
47 <xsl:call-template name="string-replace-all"> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
48 <xsl:with-param name="text" select="@value"/> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
49 <xsl:with-param name="replace">${</xsl:with-param> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
50 <xsl:with-param name="by">{$</xsl:with-param> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
51 </xsl:call-template> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
52 </xsl:attribute> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
53 </xsl:for-each> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
54 <xsl:apply-templates select="@*|node()" mode="ignore-text"/> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
55 </xsl:copy> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
56 </xsl:template> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
57 |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
58 <xsl:template match="dc:attribute|text()" mode="ignore-text"/> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
59 <xsl:template match="@*|node()" mode="ignore-text"> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
60 <xsl:copy> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
61 <xsl:apply-templates select="@*|node()"/> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
62 </xsl:copy> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
63 </xsl:template> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
64 |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
65 <xsl:template match="@*|node()"> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
66 <xsl:copy> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
67 <xsl:apply-templates select="@*|node()"/> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
68 </xsl:copy> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
69 </xsl:template> |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
70 |
43bf4976dd24
Add XSL transformation that replaces <dc:attribute> with their shortened inline notation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
71 </xsl:stylesheet> |