title: with-param not working in apply-templates
body: <p>I am currently trying to generate the creation SQL for my tables based off of a Visio diagram. I am doing this using the approach found here.</p>
  
  <p><a href="http://www.dougboude.com/blog/1/2008/11/SQL-Forward-Engineering-with-Visio-2003-Professional.cfm" rel="nofollow noreferrer">http://www.dougboude.com/blog/1/2008/11/SQL-Forward-Engineering-with-Visio-2003-Professional.cfm</a></p>
  
  <p>I am attempting to modify the xslt file found there to better model the syntax that we use in our office. Unfortunately, I cannot get the part that involves passing the table name into the template for the table columns to work. The template gets called, but it seems to ignore my parameters. </p>
  
  <pre><code>&lt;xsl:template match="Entity" mode="table"&gt;
  IF NOT EXISTS (SELECT * FROM sysobjects WHERE name = '&lt;xsl:value-of select="@PhysicalName"/&gt;')
  &lt;br /&gt;
  CREATE TABLE dbo.[&lt;xsl:value-of select="@PhysicalName"/&gt;]
  (
  &lt;br /&gt;
  &lt;xsl:for-each select="EntityAttributes/EntityAttribute"&gt;
      &lt;span style="padding-left: 20px;"&gt;
          &lt;xsl:apply-templates select="../../../../Attributes/Attribute[@AttributeID = current()/@EntityAttributeID]" mode="table"&gt;
              &lt;xsl:with-param name="EntityName" select="@PhysicalName" /&gt;
          &lt;/xsl:apply-templates&gt;
      &lt;/span&gt;
      &lt;xsl:if test="count(../../EntityAttributes/EntityAttribute) != position()"&gt;,&lt;/xsl:if&gt;
      &lt;br /&gt;
  &lt;/xsl:for-each&gt;
  )
  &lt;br /&gt;
  GO
  &lt;p /&gt;
  
  &lt;xsl:apply-templates select="EntityAnnotations/EntityAnnotation[@AnnotationType='Primary Key']" mode="pk"/&gt;
  &lt;xsl:apply-templates select="EntityAnnotations/EntityAnnotation[@AnnotationType='Alternate Key']" mode="ak"/&gt;
  &lt;xsl:apply-templates select="EntityAnnotations/EntityAnnotation[@AnnotationType='Index']" mode="idx"/&gt;
  &lt;/xsl:template&gt;
  
  &lt;!-- Create column for each EntityAttribute --&gt;
  &lt;xsl:template match="Attribute" mode="table"&gt;
      &lt;xsl:param name="EntityName"&gt;&lt;/xsl:param&gt;
      &lt;xsl:variable name="nullability"&gt;
          &lt;xsl:choose&gt;
              &lt;xsl:when test='@AllowNulls = "false"'&gt;NOT NULL CONSTRAINT DF_&lt;xsl:value-of select="$EntityName" /&gt;_&lt;xsl:value-of select="@PhysicalName"/&gt;
          &lt;/xsl:when&gt;
              &lt;xsl:otherwise&gt; NULL&lt;/xsl:otherwise&gt;
          &lt;/xsl:choose&gt;
      &lt;/xsl:variable&gt;
      &lt;xsl:variable name="incremental"&gt;
          &lt;xsl:choose&gt;
              &lt;xsl:when test='@PhysicalDatatype = "int identity"'&gt; INT IDENTITY(1,1)&lt;/xsl:when&gt;
              &lt;xsl:otherwise&gt;&lt;xsl:value-of select="@PhysicalDatatype"/&gt;&lt;/xsl:otherwise&gt;
          &lt;/xsl:choose&gt;
      &lt;/xsl:variable&gt;
  
  [&lt;xsl:value-of select="@PhysicalName"/&gt;] &lt;span style="text-transform:uppercase;"&gt;   &lt;xsl:value-of select="$incremental"/&gt;&lt;/span&gt;  &lt;xsl:value-of select="$nullability"/&gt;
  
  &lt;/xsl:template&gt;
  </code></pre>