Confusion about the Templates on island.xml.xsl

4 replies [Last post]
Joined: 04/17/2011

Now I was trying to make the chapter my self and it seems quite easy (I edited Puggsoy island) but there is one problem - What exactly is this used for and what's it for? If I can't find out my chapter may crash or even the addin won't upload on the gootool so I need explenation of it.

  <xsl:template match="/island[1]/level[3]/@ocd"/>
  <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]/level[5]"/>
  <xsl:template match="/island[1]/text()[6]"/>
  <xsl:template match="/island[1]/level[6]"/>
  <xsl:template match="/island[1]/text()[7]"/>
  <xsl:template match="/island[1]/level[7]"/>
  <xsl:template match="/island[1]/text()[8]"/>
  <xsl:template match="/island[1]/level[8]"/>
  <xsl:template match="/island[1]/text()[9]"/>
  <xsl:template match="/island[1]/level[9]"/>
  <xsl:template match="/island[1]/text()[10]"/>
  <xsl:template match="/island[1]/level[10]"/>
  <xsl:template match="/island[1]/text()[11]"/>
  <xsl:template match="/island[1]/level[11]"/>

Joined: 04/29/2009

That's why I prefer hand written xsl files, they are easier to understand.
Those lines are deleting the elements in the island.xml.

First thing you would need to do is define the level names and subtext in the text.xml file.

<string id="LEVEL_NAME_YOURLEVELNAME1" text="Your Level Name 1"/>
<string id="LEVEL_TEXT_YOURLEVELSUBTEXT1" text="Your Level Subtext 1"/>
<string id="LEVEL_NAME_YOURLEVELNAME2" text="Your Level Name 2"/>
<string id="LEVEL_TEXT_YOURLEVELSUBTEXT2" text="Your Level Subtext 2"/>

Second the islandx.xsl:

I'm assume you want to delete every existing level and than add your own ones.
Here is an easy template you could use.

<?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">yourMapName</xsl:attribute>
       <xsl:attribute name="map">islandx</xsl:attribute>
      <xsl:apply-templates/>
 
      <!-- Here is where we can insert your levels -->
 
 <level id="LEVELID1" name="LEVEL_NAME_YOURLEVELNAME1" text="LEVEL_TEXT_YOURLEVELSUBTEXT1" ocd="moves,23"/>
 <level id="LEVELID2" depends="LEVELID1" name="LEVEL_NAME_YOURLEVELNAME2" text="LEVEL_TEXT_YOURLEVELSUBTEXT2" ocd="balls,15" />
 
 
    </xsl:copy>
  </xsl:template>
</xsl:transform>

edit: just forgot the deleting line.
edit2: found another syntax error in the example. I wrote text="LEVEL_NAME_YOURLEVELSUBTEXT1" instead of text="LEVEL_TEXT_YOURLEVELSUBTEXT1"

Joined: 04/17/2011

Sorry but it confuses me even more - what exactly is Level Subtext? Is it the subtitle of your levels or is it where you write the names of the texts of your levels? Ahh but it confuses you even more - If I had a straight example like there was an example for Merging levels I would have started to make my second chapter but you guys just want to confuse me - give me an example of a chapter and random levels put together cause then I suppose all will crash... But your example is good - but I don't have to leave lines between them do I cause then the island.xml.xsl will crash, right? So basically I'l follow your instructions and I hopw it works - I understand that you gave me an example for 2 levels of chapter in island.xsl right but I think I'll be able to input 10 level information - doesn't even look that hard if you look at it like that and this is exactly what I was waiting from AP and puggsoy - if there is anyone else asking of how to make chapter tell them that you have to edit your island.xml.xsl in merge directory and give them this link to find out an example of how to edit it. I'll do the same.

Joined: 09/01/2009

Wikigoo-4evr wrote:
Ahh but it confuses you even more - If I had a straight example like there was an example for Merging levels I would have started to make my second chapter but you guys just want to confuse me

Really? Hah. The reason we don't have a straightforward example is because it isn't straightforward. Making chapters is mindblowingly difficult and you have to know precisely what you're doing because there's a lot of ways you can go wrong. A knowledge of how XML and XSL work will help you a whole lot more than an example will.

That being said, hopefully soon I'll get together a tutorial for making chapters, along with some new guidelines for doing so. But in the meantime, do whatever goomatz says. He knows what he's doing, unlike me. Tongue

Joined: 04/29/2009

Wih level subtext i meant the text displayed below the level name when the level loads.
A good example for a chapter would be the under snake by momo1524.
And yes, you can add as many levels as you want. Just add a line for each where the first two are.

Wikigoo-4evr wrote:
- but I don't have to leave lines between them do I cause then the island.xml.xsl will crash, right?

Sorry I don't get it. Do you want to put empty lines between the levels? If so, this shouldn't be a problem.