Carsten Milkau schrieb:
> What do you think about this patch (see attachment)?

Forgot the traps, sorry :) Here they are. Btw, I think you should try 
not to copy whitespace in the result tree, as it spoils all the fancy 
indenting ;) just replace

<xsl:apply-templates/>

which actually means

<xsl:apply-templates select="*|text()"/>

by

<xsl:apply-templates select="*"/>

when only tags are to be there.

Carsten
Index: pingusv1tov2.xsl
===================================================================
--- pingusv1tov2.xsl	(Revision 2456)
+++ pingusv1tov2.xsl	(Arbeitskopie)
@@ -19,13 +19,16 @@
       <version>2</version>
       <head>
         <xsl:apply-templates select="global/*|action-list"/>
+        <xsl:if test="count(global/music) = 0">
+          <music>none</music>
+        </xsl:if>
         <levelsize>
           <width><xsl:value-of  select="/pingus-level/global/width" /></width>
           <height><xsl:value-of select="/pingus-level/global/height" /></height>
         </levelsize>
       </head>
       <objects>
-        <xsl:apply-templates select="background|exit|entrance|hotspot|worldobj|liquid|group"/>
+        <xsl:apply-templates select="background|exit|entrance|hotspot|worldobj|liquid|group|groundpiece|trap"/>
       </objects>
     </pingus-level>
   </xsl:template>
@@ -58,7 +61,16 @@
         <xsl:with-param name="text" select="concat(translate($datafile, '-', '/'), '/', $ident)" />
       </xsl:call-template>
     </image>
-    <modifier><xsl:value-of select="modifier" /></modifier>
+    <modifier>
+      <xsl:choose>
+        <xsl:when test="string(modifier) != ''">
+          <xsl:value-of select="modifier" />
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text>ROT0</xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>
+    </modifier>
   </xsl:template>
 
   <xsl:template name="replace-alias">
@@ -125,4 +137,25 @@
   <xsl:template match="z-pos">
     <z><xsl:apply-templates /></z>
   </xsl:template>
+
+  <xsl:template match="groundpiece">
+    <groundpiece>
+      <type><xsl:value-of select="@type"/></type>
+      <xsl:apply-templates select="*"/>
+    </groundpiece>
+	</xsl:template>
+
+	<xsl:template match="trap">
+		<xsl:element name="{type}">
+			<xsl:apply-templates select="*"/>
+		</xsl:element>
+	</xsl:template>
+	<xsl:template match="trap/type"/>
+
+  <xsl:template match="surface|position">
+    <xsl:copy>
+      <xsl:apply-templates select="*"/>
+    </xsl:copy>
+	</xsl:template>
+
 </xsl:stylesheet>
_______________________________________________
Pingus-Devel mailing list
Pingus-Devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/pingus-devel

Reply via email to