New site style… XSL help, please :)

Okay, I wanted to blog about that yesterday, but I ended up the site restyle at 4am and also if I was able to sleep only at 6am, I wasn’t going to blog with that insomnia. I wish to thank haran who doesn’t know me 😉 He wrote some of the most beautiful webdesigns for OSWD, and are his most of the ones I used for my site (and its one of his heavy elaborated the one used for Ziotto website -note: it’s an Italian crazy and fun site of some friends of mine, and me, too :P-).

This time using XSL I was able to abstract most of the work so that I just had to change a base template file to do most of the job, but I still have some problems with XSL that I want to nail down, for who wants to help me, in the second page I’ll show what I’m trying to do and does not work as I expected.. if you’re an XSL expert, please help me :‘)

With the main template that renders the base page list, I have also a template that designs the “blocks” of the site (the box you see with content). They are declared this way:

<!-- simple block -->
<xsl:template name="block" match="block">
  <xsl:param name="id" select="@id" />
  <xsl:param name="title" select="@title" />
  <xsl:param name="content" select="./" />

  <xhtml:div class="darkerBox">
    <xsl:attribute name="id"><xsl:value-of select="$id" /></xsl:attribute>
    <xhtml:h1><xsl:value-of select="$title" /></xhtml:h1>
    <xsl:apply-templates select="$content" />

    <xhtml:br />
  </xhtml:div>
</xsl:template>

Originally, I just used a matching template for <block> tags and then repeated the <div> thing on every page, but that was not fine as I had to change all the stylesheets every time I changed template.
With the params, I can just call the named template so for example to get articles I use:

<xsl:template match="articles">
  <xsl:call-template name="block">
    <xsl:with-param name="id">articles</xsl:with-param>
    <xsl:with-param name="title">Articles' list</xsl:with-param>
    <xsl:with-param name="content" select="./" />
  </xsl:call-template>
</xsl:template>

and that works fine, as far as the <articles> tag contains block-like formatting.

For the downloads page instead I wanted to do something different, and having the content parameter be created not only by templates:

<xsl:with-param name="content">
  <xhtml:ul>
    <xsl:apply-templates />
  </xhtml:ul>
</xsl:with-param>

but this does not work at all.

Am I missing something basic here? Every suggestion is welcome 🙂

Exit mobile version