One more
[apertium.git] / apertium-oc-ca / alt.xsl
blob296fe8e3c2e489bda07fc8285af11eec8bb4fefa
1 <?xml version="1.0" encoding="UTF-8"?> <!-- -*- nxml -*- -->
2 <!--
3 Copyright (C) 2005 Universitat d'Alacant / Universidad de Alicante
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18 02111-1307, USA.
19 -->
20 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
21 <xsl:output method="text" encoding="UTF-8"/>
22 <xsl:param name="alt"/>
24 <xsl:template match="/">
25 <xsl:value-of select="string('&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#xA;')"/>
26 <xsl:apply-templates select="*|text()"/>
27 </xsl:template>
29 <xsl:template match="*">
30 <xsl:if test="not(count(./@alt)=1) or ./@alt=$alt">
31 <xsl:if test="not(local-name(.)=string('group'))">
32 <xsl:value-of select="string('&lt;')"/>
33 <xsl:value-of select="local-name(.)"/>
34 <xsl:for-each select="./@*">
35 <xsl:if test="not(local-name(.)=string('alt'))">
36 <xsl:value-of select="string(' ')"/>
37 <xsl:value-of select="local-name(.)"/>
38 <xsl:value-of select="string('=&quot;')"/>
39 <xsl:value-of select="string(.)"/>
40 <xsl:value-of select="string('&quot;')"/>
41 </xsl:if>
42 </xsl:for-each>
43 </xsl:if>
44 <xsl:choose>
45 <xsl:when test="count(text()[normalize-space(.)] | *)=0">
46 <xsl:if test="not(local-name(.)=string('group'))">
47 <xsl:value-of select="string('/&gt;')"/>
48 </xsl:if>
49 </xsl:when>
50 <xsl:otherwise>
51 <xsl:if test="not(local-name(.)=string('group'))">
52 <xsl:value-of select="string('&gt;')"/>
53 </xsl:if>
54 <xsl:apply-templates/>
55 <xsl:if test="not(local-name(.)=string('group'))">
56 <xsl:value-of select="string('&lt;/')"/>
57 <xsl:value-of select="local-name(.)"/>
58 <xsl:value-of select="string('&gt;')"/>
59 </xsl:if>
60 </xsl:otherwise>
61 </xsl:choose>
62 </xsl:if>
63 </xsl:template>
65 <xsl:template match="text()">
66 <xsl:value-of select="."/>
67 </xsl:template>
69 </xsl:stylesheet>