File: localize.xsl

package info (click to toggle)
mobyle 1.0.6~dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 8,036 kB
  • sloc: python: 19,496; sh: 54; makefile: 30; xml: 6; ansic: 5
file content (36 lines) | stat: -rw-r--r-- 1,381 bytes parent folder | download | duplicates (4)
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
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- 
	localize.xsl stylesheet
	Authors: Herv Mnager
-->
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml"  xmlns:mb="http://www.mobyle.fr">

	<xsl:namespace-alias stylesheet-prefix="mb" result-prefix="#default"/>	

	<xsl:param name="localCategoriesUrl" />
	
	<xsl:variable name="localCategories" select="document($localCategoriesUrl)"/>

	<xsl:include href="ident.xsl" />	

	<xsl:template match="head|package">
		<xsl:variable name="level">
			<xsl:if test="local-name()='head'">program</xsl:if>
			<xsl:if test="local-name()='package'">package</xsl:if>			
		</xsl:variable>
		<xsl:element name="{local-name()}">
		<xsl:apply-templates select="@*|node()[local-name()!='category']|text()" />		
		<xsl:if test="$localCategories//category[@name=current()/name/text() and @class=$level]">
			<xsl:apply-templates select="$localCategories//category[@name=current()/name/text() and @class=$level]" />
		</xsl:if>
			<xsl:if test="not($localCategories//category[@name=current()/name/text() and @class=$level])">
			<xsl:apply-templates select="category" />
		</xsl:if>
		</xsl:element>
	</xsl:template>

	<!-- remove localize.xml category element attributes so that the resulting file validates -->
	<xsl:template match="category/@*"></xsl:template>

</xsl:stylesheet>