-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcombine.xsl
More file actions
34 lines (30 loc) · 1.38 KB
/
Copy pathcombine.xsl
File metadata and controls
34 lines (30 loc) · 1.38 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
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" version="2.0">
<!-- Some overridable defaults -->
<xsl:param name="name" select="'Gamma World'"/>
<xsl:param name="partyFile" select="'/party.xml'"/>
<xsl:param name="monstersFile" select="'/monsters.xml'"/>
<xsl:param name="includeMonstersDB" select="yes"/>
<!-- Read the external documents -->
<xsl:variable name="monsters" select="document(concat($name, $monstersFile))"/>
<xsl:variable name="party" select="document(concat($name, $partyFile))"/>
<!-- Identity transform -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<!-- Encounters come from the source document,
add the monster database and include the party -->
<xsl:template match="/DMToolData">
<xsl:copy>
<xsl:apply-templates/>
<xsl:if test="$includeMonstersDB = 'yes'">
<monsters>
<xsl:copy-of select="$monsters/DMToolData/monsters/MonsterEntry"/>
<xsl:copy-of select="$party/DMToolData/monsters/MonsterEntry"/>
</monsters>
</xsl:if>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>