Solved

Help me to get this XSL more compact

Posted on 2004-03-29
4
264 Views
Last Modified: 2012-06-27
Coming from this question: http://www.experts-exchange.com/Web/Web_Languages/XML/Q_20933294.html

I have trouble writing compact XSL: the code is still too many kB. I suspect however that using some smart coding my XSL can be compacter.

The site: www.tivoli.nl (look at the "Agenda")
the XML: http://www.terminal.nl/tivoli2004/agenda/xml/nl.xml
the XSL as it was before i started compacting:  http://www.terminal.nl/tivoli2004/agenda/xml/agenda.nl.xsl.asp (35,261 bytes)
the XSL as it was after my first effort:  http://www.terminal.nl/tivoli2004/agenda/xml/agenda.nl.new.xsl.asp (29,649 bytes)

Some reduction achieved, still not satisfied. So everyone who helps me with further reduction gets points. I am only interested in a smart use of XSL functionality.

rules:
- shorter names and removing white space does not count (i can think of that myself)
- i want to reduce bandwidth use, so moving stuff to another file (which requires another HTTP request) is only valid if it reduces the total bandwidth use.
- functionality must be the same (must result in the same HTML in the browser)
- compatible with IE5+ and Mozilla.

As a rule of thumb: 100 points for every kB reduction.

0
Comment
Question by:sybe
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
conorj earned 100 total points
ID: 10712175
Hi Sybe,

The following should give you a 2/3kB reduction once you strip out all the extraneous whitespace, as it is currently indented for readability.

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:user="urn:my-namespace" version="1.0">

<xsl:param name="currentdayvalue" select="'20040330'" />
<xsl:param name="spacer" select="'/-/data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEUAAAALAAAAAABAAEAAAICRAEAOw=='" />
<xsl:output method="html"/>

<xsl:template match="/">
    <html>
        <head>
            <title>:: Tivoli :: Agenda</title>
            <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
            <meta http-equiv="imagetoolbar" content="no"/>
            <link href="http://www.terminal.nl/tivoli2004/styles/body.css" rel="stylesheet" type="text/css"/>
            <base target="_blank"/>
            <script>
                var dtNow = new Date(2004, 2, 30);
                var dtLater = new Date(2004, 3, 29);
                var bCanSearch = false;
                var sLastCalledFunction = '';
                var bTopStays = true;

                function ShowProps(oTest) {
                      var element;
                      var oTemp;
                      var sWriteCode = '';
                      for(element in oTest) {
                            oTemp = element;
                            sWriteCode += oTemp.toString() + ' = ' + eval('oTest.' + oTemp.toString()) + '\n';
                      }
                      if(document.writedom) {
                            document.writedom.innerHTML = sWriteCode;
                      } else {
                            document.getElementById('writedom').innerHTML = sWriteCode;
                      }
                }

                function TwoDigit(vIn) {
                      if(vIn.toString().length==0){return '00';}
                      if(vIn.toString().length==1){return '0' + vIn.toString();}
                      if(vIn.toString().length>1){return vIn.toString();}
                }

                function ShowComing30(sLinkText) {
                      if(!bCanSearch) {
                            alert('pagina wordt geladen...');
                            return;
                      }
                      sLastCalledFunction = 'ShowComing30()';
                      var i;
                      var j = 0;
                      var oNodeList = document.getElementById('productiondata').childNodes;
                      var iProductionDateValue = 0;
                      var iToDayValue = parseInt(dtNow.getFullYear().toString() + TwoDigit(dtNow.getMonth()+1) + TwoDigit(dtNow.getDate()));
                      var iLaterValue = parseInt(dtLater.getFullYear().toString() + TwoDigit(dtLater.getMonth()+1) + TwoDigit(dtLater.getDate()));

                      for(i=0;i&lt;oNodeList.length;i++) {
                            oNode = oNodeList.item(i);
                            iProductionDateValue = parseInt(oNode.getAttribute("production_date_value"));
                            sTagName = oNode.getAttribute("id");
                            if((iProductionDateValue &gt;= iToDayValue) &amp;&amp; (iProductionDateValue &lt;= iLaterValue)) {
                                  document.getElementById(sTagName).style.display='block';
                                  j++;
                            } else {
                                  document.getElementById(sTagName).style.display='none';
                            }
                      }
                      if(j == 0) {
                            document.getElementById('noresult').innerHTML = sLinkText + ': geen resultaten gevonden';
                      } else {
                            document.getElementById('noresult').innerHTML = '';
                      }
                      bCanSearch=true;
                      DisplayProduction();
                }

                function ShowMonthSelection(iMonthNr, iYearNr, sCompare, sLinkText) {
                      if(!bCanSearch) {
                            alert('pagina wordt geladen...');
                            return;
                      }
                      sLastCalledFunction = 'ShowMonthSelection()';
                      var oNode;
                      var i;
                      var j = 0;
                      var iMonthValue = 0;
                      var iYearValue = 0;
                      var sTagName = '';
                      var sProductionDateValue;
                      var oNodeList = document.getElementById('productiondata').childNodes;
                      for (i=0;i&lt;oNodeList.length;i++) {
                            oNode = oNodeList.item(i);
                            sTagName = oNode.getAttribute("id");
                            sProductionDateValue = oNode.getAttribute("production_date_value");
                            iMonthValue = parseInt(sProductionDateValue.substr(4,2),10);
                            iYearValue = parseInt(sProductionDateValue.substr(0,4),10);
                            if(sCompare == '=') {
                                  if(iMonthValue == iMonthNr &amp;&amp; iYearValue == iYearNr) {
                                        document.getElementById(sTagName).style.display='block';
                                        j++;
                                  } else {
                                        document.getElementById(sTagName).style.display='none';
                                  }
                            } else {
                                  if((iMonthValue &gt; iMonthNr &amp;&amp; iYearValue == iYearNr) || (iYearValue &gt; iYearNr)) {
                                        document.getElementById(sTagName).style.display='block';
                                        j++;
                                  } else {
                                        document.getElementById(sTagName).style.display='none';
                                  }
                            }
                      }
                      if(j == 0) {
                            document.getElementById('noresult').innerHTML = sLinkText + ': geen resultaten gevonden';
                      } else {
                            document.getElementById('noresult').innerHTML = '';
                      }
                      bCanSearch=true;
                      DisplayProduction();
                }

                function ShowLastAdded() {
                      if(!bCanSearch) {
                            alert('pagina wordt geladen...');
                            return;
                      }
                      sLastCalledFunction = 'ShowLastAdded()';
                      var oLastAdded = document.getElementById('lastadded');
                      if(oLastAdded.innerHTML.length&lt;0) {
                            document.getElementById('productiondata').style.display='none';
                            oLastAdded.style.display='block';
                            return;
                      }
                      var oNode;
                      var i;
                      var j = 0;
                      var sLastAdded = 'no';
                      var sTagName = '';
                      var aLastAdded = new Array();
                      var aOrderLastAdded = new Array();
                      var oCopy;
                      var oNodeList = document.getElementById('productiondata').childNodes;

                      for (i=0;i&lt;oNodeList.length;i++) {
                            oNode = oNodeList.item(i);
                            sLastAdded = oNode.getAttribute("lastadded");
                            sTagName = oNode.getAttribute("id");
                            if(sLastAdded=='yes') {
                                  document.getElementById(sTagName).style.display='block';
                                  //oCopy = oNode.cloneNode(true);
                                  //oCopy.style.display='block';
                                  //oLastAdded.insertBefore(oLastAdded,oLastAdded.childNodes.item(0));
                                  j++;
                            } else {
                                  document.getElementById(sTagName).style.display='none';
                            }
                      }
                      if(j==0) {
                            document.getElementById('noresult').innerHTML = 'geen resultaten gevonden';
                      } else {
                            document.getElementById('noresult').innerHTML = '';
                      }
                      bCanSearch=true;
                }


                function OtherSearch() {
                      var iSearchSoortId = document.othersearch.soort_id.options[document.othersearch.soort_id.selectedIndex].value;
                      var iSearchLocatieId = document.othersearch.locatie_id.options[document.othersearch.locatie_id.selectedIndex].value;
                      var sSearchText = document.othersearch.searchtext.value;
                      PerformOtherSearch(iSearchSoortId,iSearchLocatieId,sSearchText);
                }

                function PerformOtherSearch(iSearchSoortId,iSearchLocatieId,sSearchText) {
                      if(!bCanSearch) {
                            alert('pagina wordt geladen...');
                            return;
                      }
                      if(sSearchText==null) {
                            sLastCalledFunction = 'PerformOtherSearch('+iSearchSoortId.toString()+','+iSearchLocatieId.toString()+')';
                      } else {
                            sLastCalledFunction = 'PerformOtherSearch('+iSearchSoortId.toString()+','+iSearchLocatieId.toString()+','+sSearchText+')';
                      }
                      var sProductieText = '';
                      var i;
                      var j = 0;
                      var oNodeList = document.getElementById('productiondata').childNodes;
                      var bSelect = false;
                      var iSoortId = '0';
                      var iLocatieId = '0';
                      iSearchSoortId = iSearchSoortId.toString();
                      iSearchLocatieId = iSearchLocatieId.toString();

                      for (i=0;i&lt;oNodeList.length;i++) {
                            oNode = oNodeList.item(i);
                            sTagName = oNode.getAttribute("id")
                            bSelect = true;

                            if(iSearchSoortId != '0') {
                                  iSoortId = oNode.getAttribute("soort_id");
                                  if(iSoortId.toString() != iSearchSoortId.toString()) {
                                        bSelect = false;
                                  }
                            }

                            if(iSearchLocatieId != '0') {
                                  iLocatieId = oNode.getAttribute("locatie_id");
                                  if(iLocatieId.toString() != iSearchLocatieId.toString()) {
                                        bSelect = false;
                                  }
                            }

                            if(bSelect &amp;&amp; sSearchText !='' &amp;&amp; sSearchText != null) {
                                  if(oNode.innerText) {
                                        sProductieText = oNode.innerText;
                                  } else {
                                        sProductieText = oNode.innerHTML;
                                  }

                                  sProductieText = sProductieText.toLowerCase();
                                  if(sProductieText.indexOf(sSearchText.toLowerCase()) == -1) {
                                        bSelect = false;
                                  }
                            }

                            if(bSelect) {
                                  document.getElementById(sTagName).style.display='block';
                                  j++;
                            } else {
                                  document.getElementById(sTagName).style.display='none';
                            }
                      }
                      if(j == 0) {
                            document.getElementById('noresult').innerHTML = ' geen resultaten gevonden';
                      } else {
                            document.getElementById('noresult').innerHTML = '';
                      }
                      bCanSearch=true;
                      DisplayProduction();
                }


                function SetFramesetMemory(sCurrentDisplay) {
                      if(top.empty) {top.empty.sCurrentDisplay = sCurrentDisplay;}
                }

                function ShowProductionData() {
                      var sPData = document.documentElement.innerHTML;
                      prompt('productiondata',sPData);
                }

                function ToNonAgenda() {
                      if(top.bTopStays) {
                            top.masterframe.document.getElementById('menuframeset').rows='40, *';
                            top.masterframe.menu.bCanSearch=false;
                            sLastCalledFunction = '';
                      }
                }


                function AfterLoading() {
                      bCanSearch=true;
                      document.getElementById('waitingtext').style.display='none';
                }

                function DisplayProduction() {
                      document.getElementById('productiondata').style.display='inline';
                      document.getElementById('lastadded').style.display='none';
                }

            </script>
        </head>
        <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="AfterLoading();">
        <div id="waitingtext">pagina wordt geladen....</div>
        <div id="productiondata">
            <xsl:for-each select="root/production[number(concat(PYear,PMonth,PDay)) &gt;= 20040330]">
                  <div style="display:block" id="production_{ProduktieID}" locatie_id="{locatie_id}" soort_id="{soort_id}" production_date_value="{PYear}{PMonth}{PDay}" lastadded="{bIsLastAdded}">
                            <table width="700" height="185" border="0" cellpadding="0" cellspacing="0">
                        <xsl:choose>
                            <xsl:when test="bIsInHelling = '1'">
                                        <xsl:call-template name="top_row">
                                              <xsl:with-param name="location" select="'helling'"/>
                                        </xsl:call-template>
                                        <tr>
                                              <td width="4" height="175" valign="top" background="http://www.terminal.nl/tivoli2004/images/borders/border_foto_left.gif">
                                                    <img src="http://www.terminal.nl/tivoli2004/images/nav/spacer.gif" width="4" border="0" />
                                              </td>
                                              <td colspan="3" valign="top">
                                                    <table width="692" height="100%" border="0" cellpadding="0" cellspacing="0" id="tableyellow">
                                                          <tr>
                                                                <td width="200" align="center" valign="middle" bgcolor="#333333">
                                                                      <img width="160" hspace="2" vspace="2" id="event1image" alt="{ProduktieNaam}" src="/tivoli/agenda/container/{ProduktiePlaatje}" />
                                                                </td>
                                                                <td width="6" valign="top" background="http://www.terminal.nl/tivoli2004/images/borders/border_foto_right.gif" bgcolor="#FFFF00">
                                                                      <img src="http://www.terminal.nl/tivoli2004/images/nav/spacer.gif" width="6" height="1" />
                                                                </td>
                                                                <xsl:call-template name="production_data">
                                                                      <xsl:with-param name="color" select="'yellow'"/>
                                                                      <xsl:with-param name="cellcolor" select="'#FFFF00'"/>
                                                                </xsl:call-template>
                                                                <td width="6" valign="top" bgcolor="#FFFF00">
                                                                      <img src="http://www.terminal.nl/tivoli2004/images/nav/spacer.gif" width="6" height="1" />
                                                                </td>
                                                                <xsl:call-template name="text_cell">
                                                                      <xsl:with-param name="color" select="'yellow'"/>
                                                                      <xsl:with-param name="cellcolor" select="'#FFFF00'"/>
                                                                      <xsl:with-param name="imagename" select="'helling.gif'"/>
                                                                </xsl:call-template>
                                                          </tr>
                                                          <tr>
                                                                <td height="1" bgcolor="#333333"><img src="http://www.terminal.nl/tivoli2004/images/nav/spacer.gif" alt="" width="200" height="1" /></td>
                                                                <td bgcolor="#660066"><img src="http://www.terminal.nl/tivoli2004/images/nav/spacer.gif" alt="" width="6" height="1" /></td>
                                                                <td bgcolor="#FFFF00"><img src="http://www.terminal.nl/tivoli2004/images/nav/spacer.gif" alt="" width="200" height="1" /></td>
                                                                <td bgcolor="#FFFF00"><img src="http://www.terminal.nl/tivoli2004/images/nav/spacer.gif" alt="" width="6" height="1" /></td>
                                                                <td bgcolor="#FFFF00"><img src="http://www.terminal.nl/tivoli2004/images/nav/spacer.gif" alt="" width="280" height="1" /></td>
                                                          </tr>
                                                    </table>
                                                   </td>
                                              <td width="4" valign="top" background="http://www.terminal.nl/tivoli2004/images/borders/border_right_yellow.gif"><img src="http://www.terminal.nl/tivoli2004/images/nav/spacer.gif" width="4" /></td>
                                        </tr>
                                        <xsl:call-template name="bottom_rows">
                                              <xsl:with-param name="location" select="'helling'"/>
                                        </xsl:call-template>
                            </xsl:when>
                            <xsl:otherwise>
                                        <xsl:call-template name="top_row">
                                              <xsl:with-param name="location" select="'oudegracht'"/>
                                        </xsl:call-template>
                                        <tr>
                                              <td width="4" height="175" valign="top" background="http://www.terminal.nl/tivoli2004/images/borders/border_left_purple.gif">
                                                    <img src="http://www.terminal.nl/tivoli2004/images/nav/spacer.gif" width="4" border="0" />
                                              </td>
                                              <td colspan="3" valign="top">
                                                    <table width="692" height="100%" border="0" cellpadding="0" cellspacing="0" id="tablepurple">
                                                          <tr>
                                                                <xsl:call-template name="production_data">
                                                                      <xsl:with-param name="color" select="'purple'"/>
                                                                      <xsl:with-param name="cellcolor" select="'#660066'"/>
                                                                </xsl:call-template>
                                                                <td width="6" valign="top" background="http://www.terminal.nl/tivoli2004/images/borders/border_foto_left.gif" bgcolor="#660066">
                                                                      <img src="http://www.terminal.nl/tivoli2004/images/nav/spacer.gif" width="6" height="1" />
                                                                </td>
                                                                <td width="200" align="center" valign="middle" bgcolor="#333333">
                                                                      <img width="160" hspace="2" vspace="2" id="event1image" alt="{ProduktieNaam}" src="/tivoli/agenda/container/{ProduktiePlaatje}" />
                                                                </td>
                                                                <td width="6" valign="top" background="http://www.terminal.nl/tivoli2004/images/borders/border_foto_right.gif" bgcolor="#660066">
                                                                      <img src="http://www.terminal.nl/tivoli2004/images/nav/spacer.gif" width="6" height="1" />
                                                                </td>
                                                                <xsl:call-template name="text_cell">
                                                                      <xsl:with-param name="color" select="'purple'"/>
                                                                      <xsl:with-param name="cellcolor" select="'#660066'"/>
                                                                      <xsl:with-param name="imagename" select="'oudegracht.gif'"/>
                                                                </xsl:call-template>
                                                          </tr>
                                                          <tr>
                                                                <td height="1" bgcolor="#660066"><img src="http://www.terminal.nl/tivoli2004/images/nav/spacer.gif" alt="" width="200" height="1" /></td>
                                                                <td bgcolor="#660066"><img src="http://www.terminal.nl/tivoli2004/images/nav/spacer.gif" alt="" width="6" height="1" /></td>
                                                                <td bgcolor="#333333"><img src="http://www.terminal.nl/tivoli2004/images/nav/spacer.gif" alt="" width="200" height="1" /></td>
                                                                <td bgcolor="#333333"><img src="http://www.terminal.nl/tivoli2004/images/nav/spacer.gif" alt="" width="6" height="1" /></td>
                                                                <td bgcolor="#660066"><img src="http://www.terminal.nl/tivoli2004/images/nav/spacer.gif" alt="" width="280" height="1" /></td>
                                                          </tr>
                                                    </table>
                                                     </td>
                                              <td width="4" valign="top" background="http://www.terminal.nl/tivoli2004/images/borders/border_right_purple.gif"><img src="http://www.terminal.nl/tivoli2004/images/nav/spacer.gif" width="4" /></td>
                                        </tr>
                                        <xsl:call-template name="bottom_rows">
                                              <xsl:with-param name="location" select="'oudegracht'"/>
                                        </xsl:call-template>
                            </xsl:otherwise>
                        </xsl:choose>
                    </table>
                  </div>
            </xsl:for-each>
        </div>
        <div id="writedom"/>
        <div id="noresult"/>
        <div id="lastadded" style="background-color:white;display:none"><div id="laststart" style="background-color:white;display:none"><p>&#160;</p></div></div>
    </body>
</html>
</xsl:template>

<xsl:template name="border_cell">
      <xsl:param name="colspan"/>
      <xsl:param name="width"/>
      <xsl:param name="height"/>
      <xsl:param name="bgimage"/>
      <td valign="top" colspan="{$colspan}" height="{$height}" width="{$width}" background="http://www.terminal.nl/tivoli2004/images/borders/{$bgimage}.gif">
            <img width="1" height="4" src="{$spacer}" />
      </td>
</xsl:template>

<xsl:template name="bottom_cell">
      <xsl:param name="width"/>
      <td valign="top" height="1" width="{$width}">
            <img height="4" width="{$width}" src="{$spacer}" />
      </td>
</xsl:template>

<xsl:template name="top_row">
      <xsl:param name="location"/>
      <tr>
      <xsl:if test="$location = 'helling'">
            <xsl:call-template name="border_cell">
                  <xsl:with-param name="colspan" select="'2'"/>
                  <xsl:with-param name="height" select="'4'"/>
                  <xsl:with-param name="bgimage" select="'border_foto_top'"/>
            </xsl:call-template>
            <xsl:call-template name="border_cell">
                  <xsl:with-param name="width" select="'208'"/>
                  <xsl:with-param name="bgimage" select="'border_top_yellow'"/>
            </xsl:call-template>
            <xsl:call-template name="border_cell">
                  <xsl:with-param name="colspan" select="'2'"/>
                  <xsl:with-param name="bgimage" select="'border_top_yellow'"/>
            </xsl:call-template>
      </xsl:if>
      <xsl:if test="$location = 'oudegracht'">
            <xsl:call-template name="border_cell">
                  <xsl:with-param name="colspan" select="'2'"/>
                  <xsl:with-param name="height" select="'4'"/>
                  <xsl:with-param name="bgimage" select="'border_top_purple'"/>
            </xsl:call-template>
            <xsl:call-template name="border_cell">
                  <xsl:with-param name="width" select="'208'"/>
                  <xsl:with-param name="bgimage" select="'border_foto_top'"/>
            </xsl:call-template>
            <xsl:call-template name="border_cell">
                  <xsl:with-param name="colspan" select="'2'"/>
                  <xsl:with-param name="bgimage" select="'border_top_purple'"/>
            </xsl:call-template>
      </xsl:if>
      </tr>
</xsl:template>

<xsl:template name="bottom_rows">
      <xsl:param name="location"/>
    <xsl:variable name="isHelling" select="$location = 'helling'" />
      <tr>
        <xsl:call-template name="border_cell">
            <xsl:with-param name="colspan" select="'2'"/>
            <xsl:with-param name="height" select="'4'"/>
            <xsl:with-param name="bgimage" select="concat('border_', substring('foto_bottom', 1 div($isHelling)), substring('bottom_purple', 1 div not($isHelling)))"/>
        </xsl:call-template>
        <xsl:call-template name="border_cell">
            <xsl:with-param name="bgimage" select="concat('border_', substring('bottom_yellow', 1 div($isHelling)), substring('foto_bottom', 1 div not($isHelling)))"/>
        </xsl:call-template>
        <xsl:call-template name="border_cell">
            <xsl:with-param name="colspan" select="'2'"/>
            <xsl:with-param name="bgimage" select="concat('border_bottom_', substring('yellow', 1 div($isHelling)), substring('purple', 1 div not($isHelling)))"/>
        </xsl:call-template>
      </tr>
      <tr>
            <xsl:call-template name="bottom_cell"><xsl:with-param name="width" select="'4'"/></xsl:call-template>
            <xsl:call-template name="bottom_cell">
            <xsl:with-param name="width" select="concat('20', substring('6', 1 div $isHelling), substring('0', 1 div(not($isHelling))))"/>
        </xsl:call-template>
            <xsl:call-template name="bottom_cell">
            <xsl:with-param name="width" select="concat('20', substring('2', 1 div $isHelling), substring('8', 1 div(not($isHelling))))"/>
        </xsl:call-template>
            <xsl:call-template name="bottom_cell"><xsl:with-param name="width" select="'284'"/></xsl:call-template>
            <xsl:call-template name="bottom_cell"><xsl:with-param name="width" select="'4'"/></xsl:call-template>
      </tr>
</xsl:template>

<xsl:template name="entreedata">
      <xsl:param name="color"/>
      <table width="95%"  border="0" align="center" cellpadding="0" cellspacing="0" id="table{$color}">
            <tr>
                  <td>
                        <br />
                  <xsl:if test="normalize-space(ZaalOpen)">
                        <span class="{$color}actinfo">
                              <xsl:value-of select="'zaal open'"/>
                        </span>
                        &#160;<xsl:value-of select="ZaalOpen"/><br />
                  </xsl:if>
                  <xsl:if test="normalize-space(AanvangProduktie)">
                        <span class="{$color}actinfo">
                              <xsl:value-of select="'aanvang'"/>
                        </span>
                        &#160;<xsl:value-of select="AanvangProduktie"/><br />
                  </xsl:if>
                  <xsl:if test="normalize-space(Entreeprijs1)">
                        <span class="{$color}actinfo">
                              <xsl:value-of select="'entree'"/>
                        </span>
                        &#160;<xsl:value-of select="concat('&#8364;',Entreeprijs1)"/><br />
                  </xsl:if>
                  <xsl:if test="normalize-space(StudUpas1)">
                        <span class="{$color}actinfo">
                              <xsl:value-of select="'studenten'"/>
                        </span>
                        &#160;<xsl:value-of select="concat('&#8364;',StudUpas1)"/><br />
                  </xsl:if>
                  <xsl:if test="normalize-space(Entreeprijs2)">
                        <span class="{$color}actinfo">
                              <xsl:value-of select="'na afloop'"/>
                        </span>
                        &#160;<xsl:value-of select="concat('&#8364;',Entreeprijs2)"/><br />
                  </xsl:if>
                  <xsl:if test="normalize-space(StudUpas2)">
                        <span class="{$color}actinfo">
                              <xsl:value-of select="'studenten'"/>
                        </span>
                        &#160;<xsl:value-of select="concat('&#8364;',StudUpas2)"/><br />
                  </xsl:if>
                        <xsl:if test="number(Voorverkoop) and normalize-space(StartdatumVVK) and number(currentdayvalue)&lt;number(VvkNr)">
                              <span class="{$color}actinfo">start voorverkoop</span><br />
                              <xsl:value-of select="StartdatumVVK"/><br />
                        </xsl:if>
                        <xsl:if test="Uitverkocht = 'True'">
                              <span class="uitverkocht">uitverkocht</span><br />
                        </xsl:if>
                        <xsl:if test="normalize-space(TicketserviceURL) and number(concat(PYear,PMonth,PDay)) &gt; 20040409">
                              <br />
                              <a href="{TicketserviceURL}" target="_blank">
                                    <img src="http://www.terminal.nl/tivoli2004/images/nav/ticketservice.gif" border="0" vspace="2" />
                              </a>
                              <br />
                        </xsl:if>
                        <br />
                  </td>
            </tr>
      </table>
</xsl:template>

<xsl:template name="production_data">
      <xsl:param name="color"/>
      <xsl:param name="cellcolor"/>
      <td width="200" align="left" valign="top" bgcolor="{$cellcolor}">
            <span class="{$color}date">
                  <xsl:value-of select="ProduktieDatum"/>
            </span>
            <br />
            <span class="{$color}act">
                  <xsl:value-of select="ProduktieNaam"/>
            </span>
            <xsl:if test="normalize-space(ProduktieURL)">
                  <a href="{ProduktieURL}">
                        <img border="0" src="http://www.terminal.nl/tivoli2004/images/nav/url_{$color}_right.gif" />
                  </a>
                  <br />
            </xsl:if>
            <xsl:if test="normalize-space(Ondertitel)">
                  <br />
                  <span class="{$color}actsubtxt">
                        <xsl:value-of select="Ondertitel"/>
                  </span><br />
            </xsl:if>
            <xsl:if test="normalize-space(Support1Naam)">
                  <br />
                  <span class="{$color}actsupport">
                        <xsl:value-of select="Support1Naam"/>
                  </span>
                  <xsl:if test="normalize-space(Support1URL)">
                        <a href="{Support1URL}">
                              <img border="0" src="http://www.terminal.nl/tivoli2004/images/nav/url_{$color}_right.gif" />
                        </a>
                        <br />
                  </xsl:if>
            </xsl:if>
            <xsl:if test="normalize-space(Support2Naam)">
                  <br />
                  <span class="{$color}actsupport">
                        <xsl:value-of select="Support2Naam"/>
                  </span>
                  <xsl:if test="normalize-space(Support2URL)">
                        <a href="{Support2URL}">
                              <img border="0" src="http://www.terminal.nl/tivoli2004/images/nav/url_{$color}_right.gif" />
                        </a>
                        <br />
                  </xsl:if>
            </xsl:if>
            <xsl:if test="normalize-space(Support2URL)">
                  <span class="{$color}actsupport"><xsl:value-of select="AfterParty"/></span>
                  <xsl:if test="boolean(AfterPartyURL)">
                        <a href="{AfterPartyURL}">
                              <img border="0" src="http://www.terminal.nl/tivoli2004/images/nav/url_{$color}_right.gif" />
                        </a>
                        <br />
                  </xsl:if>
            </xsl:if>
            <xsl:call-template name="entreedata">
                  <xsl:with-param name="color" select="$color"/>
            </xsl:call-template>
      </td>
</xsl:template>

<xsl:template name="text_cell">
      <xsl:param name="color"/>
      <xsl:param name="cellcolor"/>
      <xsl:param name="imagename"/>
      <td width="280" align="left" valign="bottom" bgcolor="{$cellcolor}">
            <table width="280" height="100%" border="0" id="table{$color}">
                  <tr width="280">
                        <td class="{$color}actdescr">
                              <xsl:copy-of select="ProduktieTekst"/><br /><br />
                              <xsl:if test="normalize-space(Support1Naam) and normalize-space(Support1Tekst)">
                                    <xsl:value-of select="Support1Tekst" disable-output-escaping="yes"/><br /><br />
                              </xsl:if>
                              <xsl:if test="normalize-space(Support2Naam) and normalize-space(Support2Tekst)">
                                    <xsl:value-of select="Support2Tekst" disable-output-escaping="yes"/><br /><br />
                              </xsl:if>
                              <xsl:if test="normalize-space(Afterparty) and normalize-space(AfterPartyTekst)">
                                    <xsl:value-of select="AfterPartyTekst" disable-output-escaping="yes"/><br /><br />
                              </xsl:if>
                        </td>
                  </tr>
                  <tr width="280">
                        <td valign="bottom" width="280">
                              <table width="280" border="0">
                                    <tr>
                                          <td width="210">
                                                <xsl:if test="normalize-space(SoundsLike1) or normalize-space(SoundsLike2)">
                                                      <table width="210">
                                                            <tr>
                                                                  <td width="28" valign="top">
                                                                        <img src="http://www.terminal.nl/tivoli2004/images/nav/klinkt_als.gif" width="28" height="28" />
                                                                  </td>
                                                                  <td class="{$color}info">
                                                                        <xsl:if test="normalize-space(SoundsLike1)">
                                                                              <xsl:value-of select="SoundsLike1"/><br />
                                                                        </xsl:if>
                                                                        <xsl:if test="normalize-space(SoundsLike2)">
                                                                              <xsl:value-of select="SoundsLike2"/><br />
                                                                        </xsl:if>
                                                                  </td>
                                                            </tr>
                                                      </table>
                                                </xsl:if>
                                                <img width="199" height="26" alt="production ({ProduktieID})" src="http://www.terminal.nl/tivoli2004/images/nav/{$imagename}" />
                                          </td>
                                          <td align="right" valign="bottom" width="70">
                                                <a href="http://www.terminal.nl/tivoli2004/agenda/cu.asp?production_id={ProduktieID}" target="_parent">
                                                      <img src="http://www.terminal.nl/tivoli2004/images/nav/cu.gif" width="50" height="28" border="0" />
                                                </a>
                                          </td>
                                    </tr>
                              </table>
                        </td>
                  </tr>
            </table>
      </td>
</xsl:template>

</xsl:stylesheet>

Hope this helps.

rgds,
Conor.
0
 
LVL 6

Expert Comment

by:metalmickey
ID: 10713009
could you remove the javascript and place it in a separate document and link it to your xslt?

<script src="yourscript.js" language="JavaScript" type="text/javascript"></script>

i think at present you'll need to use a CDATA section to encapsulate the script to stop it being parsed.

MM
0
 
LVL 28

Author Comment

by:sybe
ID: 10713149
@conorj
I am currently processing your suggestions. Thanks. Watch out for a "points for" question for you.

@metalmickey
First of all removing of the javascript to outside does not help reducing bandwidth. Secondly, Mozilla browsers don't eat external javascripts in xml/xsl tranformed HTML (stylesheet is not a problem, external javascript is).
The javascript as it is now works fine.
0
 
LVL 28

Author Comment

by:sybe
ID: 10713345
@conorj

You lost me on this code. Can you please explain it?

<xsl:with-param name="bgimage" select="concat('border_', substring('foto_bottom', 1 div($isHelling)), substring('bottom_purple', 1 div not($isHelling)))" />

0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Header in SQL XML PATH 4 53
Custom Ribbon doesn't refresh 7 80
Parsing the XML data to SQL Server 4 59
ASP.NET reading ATOM 2 51
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now