Saturday, March 24, 2012

Passing Variable to XSLT

I have a ASP.NET application written in VB.net 2003 with a form I am
using to create an export file. Using XslTransform class I have a form
that collects data and executes a stored procedure to pull information
from my SQL Database. I would like to include information from a
textbox on the form in the XSL stylesheet. Can some one please explain
how I can pull information from my code and pass it to the stylesheet?
Thanks
CharlesRead this: http://msdn2.microsoft.com/en-us/library/ts9by56w.aspx
<cbanks@.bjtsupport.com> wrote in message
news:1133885799.818228.237430@.g49g2000cwa.googlegroups.com...
>I have a ASP.NET application written in VB.net 2003 with a form I am
> using to create an export file. Using XslTransform class I have a form
> that collects data and executes a stored procedure to pull information
> from my SQL Database. I would like to include information from a
> textbox on the form in the XSL stylesheet. Can some one please explain
> how I can pull information from my code and pass it to the stylesheet?
> Thanks
> Charles
>
One thing that comes to mind, though I'm sure I'm overcomplicating
it... is to make the XSLT an aspx page (you can specify the
appropriatae content-type in the codebehind) and pass it a query
paramater (MyXslt.xsl.aspx?Id=7). I do this with my ECMAScript
(JavaScript) at times like "GetFirefoxSVGInformation.js.aspx?id=314"
This would work clientside, but should be close on serverside too.
Peter,
Thanks for the quick reply! I'll work with that information.
Charles
Being new to all of this, I need to ask one more question. Once the
variable is passed, how do I insert it into my xslt?
<xsl:for-each select="PrintChecks/tblChecks">
<xsl:text>TRANS CHECK </xsl:text>
<xsl:text></xsl:text><xsl:value-of select="fldFirstName"/>
<xsl:text> </xsl:text><xsl:value-of select="fldLastName"/>
var needs to go here
...
/xsl:for-each
Thanks again.
I was able to figure everything out thanks to the link Peter sent.
Just goes to show ya that a little help from some one in these groups
goes a long way!
Thanks again!
Charles

0 comments:

Post a Comment