File: xinclude.xsl

package info (click to toggle)
xgridfit 2.2a-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 2,232 kB
  • sloc: python: 1,262; xml: 466; sh: 283; makefile: 114; sed: 45
file content (33 lines) | stat: -rw-r--r-- 879 bytes parent folder | download | duplicates (6)
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
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
		version="1.0">
  <xsl:output method="xml" encoding="UTF-8"/>
  <xsl:param name="file-a"/>

  <xsl:template match="/">
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="xi:include" xmlns:xi="http://www.w3.org/2001/XInclude">
    <xsl:variable name="h">
      <xsl:choose>
	<xsl:when test="contains(@href,'#')">
	  <xsl:value-of select="substring-before(@href,'#')"/>
	</xsl:when>
	<xsl:otherwise>
	  <xsl:value-of select="@href"/>
	</xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:if test="$h != $file-a">
      <xsl:copy-of select="."/>
    </xsl:if>
  </xsl:template>

  <xsl:template match="node()|@*" priority="-0.5">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

</xsl:stylesheet>