forked from fengbird/JavaWebCoreNote
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmerge.xslt
More file actions
52 lines (38 loc) · 1.19 KB
/
merge.xslt
File metadata and controls
52 lines (38 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<xsl:stylesheet
xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version="1.0">
<xsl:output omit-xml-declaration="yes"/>
<xsl:param name="i"/>
<xsl:param name="trans">/tmp/source.xml</xsl:param>
<xsl:template match="/">
<xsl:message>
i: <xsl:value-of select="$i"/>
</xsl:message>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="*">
<xsl:element name="{name()}">
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="XPathTutorial">
<xsl:element name="{name()}">
<xsl:copy-of select="@*"/>
<xsl:apply-templates select="key | description"/>
<description lang="rus">
<xsl:copy-of select="document($trans)//page[@id = $i]/description/node()"/>
</description>
<xsl:apply-templates select="source | example"/>
</xsl:element>
</xsl:template>
<xsl:template match="example">
<xsl:element name="{name()}">
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
<p lang="rus">
<xsl:copy-of select="document($trans)//page[@id = $i]/example[@path = current()/@path]/node()"/>
</p>
<xsl:apply-templates select="source | example"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>