Make XSLT params optional

This XSLT snippet makes the param passed into the XSLT file optional.

Rather than have to force params in the url to get a certain view e.g. , default params can be hidden away inside the XSLT file leaving the url to be simplified e.g.

<?xml version="1.0"?>

<xsl:stylesheet xmlns:xsl="" version="1.0">

  <xsl:param name="view">summary</xsl:param>  

  <xsl:template match="tasks">

    <div id="articles">
      <div id="records">
         <p>123 GO! <xsl:value-of select="$view"/></p>
          <xsl:if test="$view='blue'"><p>great show!</p></xsl:if>
          <xsl:if test="$view='summary'"><p>average show!</p></xsl:if>
        <xsl:apply-templates select="records"/>

Note: The important thing to remember here is the param declaration is at the top, and outside the template.

test 1):

output extract 1):

123 GO! blue

great show!

test 2):

output extract 2):

123 GO! summary

average show!