Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSLTransform Parameters

Status
Not open for further replies.

tbrentlong

Programmer
Apr 22, 2003
5
US
I have an xslt stylesheet with the following params defined:

<!-- Declare filter parameters. -->
<xsl:param name=&quot;filterInactive&quot;>true</xsl:param>
<xsl:param name=&quot;filterTimeframe&quot;>0</xsl:param>


I attempt to populate them using the code below:

objParams.AddParam(&quot;filterTimeframe&quot;,
&quot;&quot;,
lngPos.ToString())


It errors out with the message ['' is an invalid QName].

If I change the second parameter to &quot;xsl&quot;, I no longer get the error, but the parameter is not passed when I call the transform method on the XSLTransform object and pass in the dom doc, the paramlist and a writer.

Anyone triumphed over this?

bl
 
In case anyone runs into this error, I've found at least one answer to the problem. In my case, there was dynamic sorting in the template that could result in a blank name being specified for the sort select. In the prior version of XSL/XML, the error was ignored. The .net version barfs on it and throws the 'Invalid QName' error. To avoid the problem, I wrote xsl:when statements around the apply-templates.

<xsl:choose>
<xsl:when test=&quot;string-length($sort1col) > 0&quot;>
<xsl:apply-templates select=&quot;*/data_summary[number(item_count) > 0 and timeframe_months=$filterTimeframe]&quot;>
<xsl:sort select=&quot;*[name() = $sort1col]&quot; data-type=&quot;{ms:node-set($rptcols)/rptcol/type[parent::*/name = $sort1col]}&quot; order=&quot;{$sort1dir}&quot;/>
</xsl:apply-templates>
</xsl:when>
</xsl:choose>

Hope this helps someone.

bl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top