XSL Trouble

18 replies [Last post]
Joined: 12/29/2008

Okay, so I am making a better version of my UnderSnake XSL, for reasons explained here (comment #20). Problem is gootool cannot merge, it says:

Addin format exception in UnderSnake:
Error tranforming res/islands/island5.xml.xsl:
Impossible to compile stylesheet (com.goofans.gootool.v)

Also, here is the xsl code:

<xsl:output encoding="UTF-8"/>
  <!--Select all nodes-->
  <xsl:template match="node()|@*">
    <xsl:copy>
      <xsl:apply-templates select="node()|@*"/>
    </xsl:copy>
  </xsl:template>
 
  <xsl:template match="/island[1]/@name">
    <xsl:attribute name="name">UNDERSNAKE</xsl:attribute>
  </xsl:template>
  <xsl:template match="/island[1]/@map">
    <xsl:attribute name="map">UnderSnake</xsl:attribute>
  </xsl:template>
 
  <xsl:template match="/island[1]/text()[1]"> </xsl:template>
  <xsl:template match="/island[1]/level[1]"/>
  <xsl:template match="/island[1]/text()[2]"/>
  <xsl:template match="/island[1]/level[2]"/>
  <xsl:template match="/island[1]/text()[3]"/>
  <xsl:template match="/island[1]/level[3]"/>
  <xsl:template match="/island[1]/text()[4]"/>
  <xsl:template match="/island[1]/level[4]"/>
  <xsl:template match="/island[1]/text()[5]"/>
 
  <xsl:template match="/island[1]">
    <xsl:element name="{name()}">
      <xsl:apply-templates select="@*"/>
      <level id="DepthDirection" name="LEVEL_NAME_DEPTHDIRECTION" text="LEVEL_TEXT_DEPTHDIRECTION" ocd="moves,11"/>
      <level id="SurvivalSupport" depends="DepthDirection" name="LEVEL_NAME_SURVIVALSUPPORT" text="LEVEL_TEXT_SURVIVALSUPPORT" ocd="moves,8"/>
      <level id="AutomaticAscension" depends="SurvivalSupport" name="LEVEL_NAME_AUTOMATICASCENSION" text="LEVEL_TEXT_AUTOMATICASCENSION" ocd="time,70"/>
      <level id="FlyingAndFalling" depends="ClimbingConnection,DangerousDangling" name="LEVEL_NAME_FLYINGANDFALLING" text="LEVEL_TEXT_FLYINGANDFALLING"/>
      <level id="DangerousDangling" depends="UnderSnakeLevel" name="LEVEL_NAME_DANGEROUSDANGLING" text="LEVEL_TEXT_DANGEROUSDANGLING" ocd="moves,15"/>
      <level id="StalacstaticSleep" depends="AutomaticAscension" name="LEVEL_NAME_STALACSTATICSLEEP" text="LEVEL_TEXT_STALACSTATICSLEEP" ocd="balls,11"/>
      <level id="ClimbingConnection" depends="StalacstaticSleep" name="LEVEL_NAME_CLIMBINGCONNECTION" text="LEVEL_TEXT_CLIMBINGCONNECTION" ocd="moves,14"/>
      <level id="UnderSnakeLevel" depends="AutomaticAscension" name="LEVEL_NAME_UNDERSNAKELEVEL" text="LEVEL_TEXT_UNDERSNAKELEVEL" ocd="moves,13"/>
      <level id="TremblingTrust" depends="FlyingAndFalling" name="LEVEL_NAME_TREMBLINGTRUST" text="LEVEL_TEXT_TREMBLINGTRUST" ocd="moves,1"/>
      <level id="SecondSuicide" depends="TremblingTrust" name="LEVEL_NAME_SECONDSUICIDE" text="LEVEL_TEXT_SECONDSUICIDE" ocd="moves,9"/>
    </xsl:element>
  </xsl:template>
</xsl:stylesheet>

You see, instead of transforming existing levels and copying the rest, this is supposed to delete all <level> entities and THEN copying my own <level> , this would avoid problems such as the one described in the comment linked above.
I'm not very good with XSL, can anyone help me with this?

Check out my SoundCloud, MomoSoundWaves

Joined: 04/29/2009

That was the idea I had too.
Here is what i've done so far:

<?xml version="1.0" encoding="ISO-8859-1"?>
 
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 
  <!-- Copy everything not matched by another rule -->
  <xsl:template match="* | comment()">
    <xsl:copy>
      <xsl:copy-of select="@*"/>
      <xsl:apply-templates/>
    </xsl:copy>
  </xsl:template>
 
 
  <!-- Delete existing levels -->
  <xsl:template match="/island/level"/>
 
 
   <!-- add new levels -->
  <xsl:template match="/island">
    <xsl:copy>
      <xsl:copy-of select="@*"/>
 
      <xsl:apply-templates/>
    <level id="DepthDirection" name="LEVEL_NAME_DEPTHDIRECTION" text="LEVEL_TEXT_DEPTHDIRECTION" cutscene="levelFadeOut,youGotMail,gooTransition_out" ocd="moves,11"/>
    <level id="SurvivalSupport" depends="DepthDirection" name="LEVEL_NAME_SURVIVALSUPPORT" text="LEVEL_TEXT_SURVIVALSUPPORT" ocd="moves,8"/>
    <level id="AutomaticAscension" depends="SurvivalSupport" name="LEVEL_NAME_AUTOMATICASCENSION" text="LEVEL_TEXT_AUTOMATICASCENSION" ocd="time,70"/>
    <level id="FlyingAndFalling" depends="ClimbingConnection,DangerousDangling" name="LEVEL_NAME_FLYINGANDFALLING" text="LEVEL_TEXT_FLYINGANDFALLING"/>
    <level id="DangerousDangling" depends="UnderSnakeLevel" name="LEVEL_NAME_DANGEROUSDANGLING" text="LEVEL_TEXT_DANGEROUSDANGLING" ocd="moves,1"/>
    <level id="StalacstaticSleep" depends="AutomaticAscension" name="LEVEL_NAME_STALACSTATICSLEEP" text="LEVEL_TEXT_STALACSTATICSLEEP" ocd="balls,11"/>
    <level id="ClimbingConnection" depends="StalacstaticSleep" name="LEVEL_NAME_CLIMBINGCONNECTION" text="LEVEL_TEXT_CLIMBINGCONNECTION" ocd="moves,14"/>
    <level id="UnderSnakeLevel" depends="AutomaticAscension" name="LEVEL_NAME_UNDERSNAKELEVEL" text="LEVEL_TEXT_UNDERSNAKELEVEL" ocd="moves,13"/>
    <level id="TremblingTrust" depends="FlyingAndFalling" name="LEVEL_NAME_TREMBLINGTRUST" text="LEVEL_TEXT_TREMBLINGTRUST" ocd="moves,0"/>
    <level id="SecondSuicide" depends="TremblingTrust" name="LEVEL_NAME_SECONDSUICIDE" text="LEVEL_TEXT_SECONDSUICIDE" ocd="moves,9"/>
 
    </xsl:copy>
  </xsl:template>
</xsl:transform>

The only thing what's missing there is to change the map and island name attribute. Having little trouble with it but I'm on it.

Joined: 12/23/2010

I also suck with XSL, and Notepad++ isn't giving any syntax errors.

All I can suggest is to make sure that the XML you're using as the source is the island.xml from your original WoG installation, and that your new XML isn't effected by any other addins.

Sorry, that's all my usefulness Tongue

Joined: 12/29/2008

The original xml is indeed from a fresh wog install, and Undersnake is the only addin in Gootool. What do I do Sad
Thanks Goomatz btw!

Check out my SoundCloud, MomoSoundWaves

Joined: 04/29/2009

Ok I got it:

<?xml version="1.0" encoding="ISO-8859-1"?>
 
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 
  <!-- Copy everything not matched by another rule -->
  <xsl:template match="* | comment()">
    <xsl:copy>
      <xsl:copy-of select="@*"/>
      <xsl:apply-templates/>
    </xsl:copy>
  </xsl:template>
 
 
  <!-- Delete existing levels -->
  <xsl:template match="/island/level"/>
 
 
  <xsl:template match="/island">
    <xsl:copy>
      <xsl:copy-of select="@*"/>
       <!-- change name and map attribute -->
       <xsl:attribute name="name">UNDERSNAKE</xsl:attribute>
       <xsl:attribute name="map">UnderSnake</xsl:attribute>
      <xsl:apply-templates/>
        <!-- add new levels here -->
        <level id="DepthDirection" name="LEVEL_NAME_DEPTHDIRECTION" text="LEVEL_TEXT_DEPTHDIRECTION" cutscene="levelFadeOut,youGotMail,gooTransition_out" ocd="moves,11"/>
        <level id="SurvivalSupport" depends="DepthDirection" name="LEVEL_NAME_SURVIVALSUPPORT" text="LEVEL_TEXT_SURVIVALSUPPORT" ocd="moves,8"/>
        <level id="AutomaticAscension" depends="SurvivalSupport" name="LEVEL_NAME_AUTOMATICASCENSION" text="LEVEL_TEXT_AUTOMATICASCENSION" ocd="time,70"/>
        <level id="FlyingAndFalling" depends="ClimbingConnection,DangerousDangling" name="LEVEL_NAME_FLYINGANDFALLING" text="LEVEL_TEXT_FLYINGANDFALLING"/>
        <level id="DangerousDangling" depends="UnderSnakeLevel" name="LEVEL_NAME_DANGEROUSDANGLING" text="LEVEL_TEXT_DANGEROUSDANGLING" ocd="moves,1"/>
        <level id="StalacstaticSleep" depends="AutomaticAscension" name="LEVEL_NAME_STALACSTATICSLEEP" text="LEVEL_TEXT_STALACSTATICSLEEP" ocd="balls,11"/>
        <level id="ClimbingConnection" depends="StalacstaticSleep" name="LEVEL_NAME_CLIMBINGCONNECTION" text="LEVEL_TEXT_CLIMBINGCONNECTION" ocd="moves,14"/>
        <level id="UnderSnakeLevel" depends="AutomaticAscension" name="LEVEL_NAME_UNDERSNAKELEVEL" text="LEVEL_TEXT_UNDERSNAKELEVEL" ocd="moves,13"/>
        <level id="TremblingTrust" depends="FlyingAndFalling" name="LEVEL_NAME_TREMBLINGTRUST" text="LEVEL_TEXT_TREMBLINGTRUST" ocd="moves,0"/>
        <level id="SecondSuicide" depends="TremblingTrust" name="LEVEL_NAME_SECONDSUICIDE" text="LEVEL_TEXT_SECONDSUICIDE" ocd="moves,9"/>
 
    </xsl:copy>
  </xsl:template>
</xsl:transform>

Joined: 12/29/2008

Thanks! I'll test it tomorrow! I's strange though, when I first did it manually, it looked kind of like what you have here, there must have been a mistake somewhere. This means I can add cutscenes!

Check out my SoundCloud, MomoSoundWaves

Joined: 04/29/2009

I already tested it Wink It's working
Plus I learned a bit more about xsl Smile
edit:

momo1526 wrote:
I's strange though, when I first did it manually, it looked kind of like what you have here, there must have been a mistake somewhere.

I can tell you a thing or two about little typos crashing up a xsl file. Smile

Joined: 12/29/2008

Goomatz, you are truly awesome!
EDIT: Typos? What where?
EDIT 2: I'm starting to wonder if it wouldn't be a good idea to explain all this in the book page of Chapters and Islands (or if you want/can can someone give me authorisation to edit it myself?)

Check out my SoundCloud, MomoSoundWaves

Joined: 12/23/2010

Sorry, can't give you permission. Seriously though, I really don't have the tools to do so. If you like, you can email me with your changes, and I can edit them in for you. My address is puggsoy *at* gmail *dot* com.

Joined: 12/29/2008

Ok, I'll see.

Check out my SoundCloud, MomoSoundWaves

Joined: 04/29/2009

It is already explained here: http://goofans.com/developers/addin-file-format/merge-directory
All I know about merging is from there. It's not about islands but levels but you can transfer it. But go ahead it is easier to make a chapter with it.

Joined: 12/29/2008

I mean like give a template xsl/xml for chapters/islands.
EDIT: I tested the xsl and it doesn't work for me so I'll go with overcompiling. Unfortunately, though I can add existing cutscenes, Gootool refuses to copy the goomod because it says it is unsupported even though my bintls are in the override directory. However, my resources are obviously in the compile directory so I'll investigate, at earliest next week... My movies are ready though, first and last level... I might make one for Dangerous Dangling...

Check out my SoundCloud, MomoSoundWaves

Joined: 07/08/2011

You place ALL files in the override directory unless they're an xml or xsl.

Joined: 04/29/2009

Momo can you post the xsl you used. I'm 100% sure the one I posted is working. You also could send me an e-mail (goomatz(at) gmx.de) with your goomod and I'll have a look at it.

Red, I don't get it, why should he put xml and xsl in override?

Joined: 07/08/2011

goomatz wrote:
Red, I don't get it, why should he put xml and xsl in override?

RedTheGreen wrote:
unless

Joined: 04/29/2009

Oh, indeed you said unless. Don't know how I could overread it. Puzzled

Joined: 12/29/2008

I know, the movie resources are in xml format. The xsl I used was yours except I changed it to clear only the 4 existing levels, which crashed, so I changed it back, I might have killed it by doing so, I'll try both.

Check out my SoundCloud, MomoSoundWaves

Joined: 04/29/2009

Try

<xsl:template match="/island/level[1]"/>
<xsl:template match="/island/level[2]"/>
<xsl:template match="/island/level[3]"/>
<xsl:template match="/island/level[4]"/>

edit: wait. I think you should rather delete all levels in general with <xsl:template match="/island/level"/> as the game crashes if there is an uncompleted level which doesn't have a button.

Joined: 12/29/2008

I know, I tested both...

Check out my SoundCloud, MomoSoundWaves