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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic XSL 1

Status
Not open for further replies.

GIGN

Programmer
Oct 6, 2000
1,082
0
0
NZ
Is there any way to send variables to an XSL file, so I can pull out records based on some id?

Usually I just use the DOM methods for this, just wondering if there is any other way - probably not right?

<bb/>
 
This is what you are looking for...

Dim xslt As New Msxml2.XSLTemplate
Dim xslDoc As New Msxml2.FreeThreadedDOMDocument
Dim xmlDoc As New Msxml2.DOMDocument
Dim xslProc As IXSLProcessor
xslDoc.async = False
xslDoc.Load &quot;sample.xsl&quot;
Set xslt.stylesheet = xslDoc
xmlDoc.async = False
xmlDoc.Load &quot;books.xml&quot;
Set xslProc = xslt.createProcessor()
xslProc.input = xmlDoc
xslProc.addParameter &quot;param1&quot;, &quot;Hello&quot;
xslProc.Transform
MsgBox xslProc.output
Sample.xsl

<xsl:stylesheet xmlns:xsl=&quot; version=&quot;1.0&quot;>
<xsl:eek:utput method=&quot;html&quot;/>
<xsl:param name=&quot;param1&quot;/>
<xsl:template match=&quot;/&quot;>
The parameter value was: <xsl:value-of select=&quot;$param1&quot;/>
</xsl:template>
</xsl:stylesheet>
 
Thats the one, cheers.

<bb/>
 
Hi, what about if I do not want to use VBScript to do the transform ?
ie I declare in the xml file which xsl stylesheet to use
<?xml-stylesheet type=&quot;text/xsl&quot; href=&quot;template.xsl&quot; ?>
How do I pass in parameters in this case ?
 
Well, you can't I don't suppose, since the addParameter() is a method belonging to the XML DOM, and an XSLProcessor object is required, but I see what you are getting at.

<bb/>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top