Loading XSL Templates
-
I'm using an XML file to hold a bunch of links, each of these links also have a category assigned to them. Here is an example:
- 57 Business Links Clark County Services http://www.co.clark.nv.us
I use this .asp script that loads an XML file with an XSL file. The beauty of this ASP file was that you could pass the name of the XSL file, and it would load it. Now what I would like to do, is just have 1 xsl file, and use the .asp file to transform only a certain template in the .xsl file. (There would be several different teplates in there...) Is this possible? Below is the .asp file I'm using...sub dispXML(toCall) '------ Find out which XSL file needs to be called ------------ styleFile = Server.MapPath(toCall) '------ DISPLAY THE XML DATA ------------ ' Linking XML and XSL together sourceFile = Server.MapPath("linkList.xml") set source = Server.CreateObject("Microsoft.XMLDOM") source.async = false source.load(sourceFile) set style = Server.CreateObject("Microsoft.XMLDOM") style.async = false style.load(styleFile) Response.Write source.transformNode(style) end sub
Any help would be great. Thanks. -
I'm using an XML file to hold a bunch of links, each of these links also have a category assigned to them. Here is an example:
- 57 Business Links Clark County Services http://www.co.clark.nv.us
I use this .asp script that loads an XML file with an XSL file. The beauty of this ASP file was that you could pass the name of the XSL file, and it would load it. Now what I would like to do, is just have 1 xsl file, and use the .asp file to transform only a certain template in the .xsl file. (There would be several different teplates in there...) Is this possible? Below is the .asp file I'm using...sub dispXML(toCall) '------ Find out which XSL file needs to be called ------------ styleFile = Server.MapPath(toCall) '------ DISPLAY THE XML DATA ------------ ' Linking XML and XSL together sourceFile = Server.MapPath("linkList.xml") set source = Server.CreateObject("Microsoft.XMLDOM") source.async = false source.load(sourceFile) set style = Server.CreateObject("Microsoft.XMLDOM") style.async = false style.load(styleFile) Response.Write source.transformNode(style) end sub
Any help would be great. Thanks.yes use
xsl:param
"When the only tool you have is a hammer, a sore thumb you will have."
-
yes use
xsl:param
"When the only tool you have is a hammer, a sore thumb you will have."
-
ah - yes. My only problem has been passing something TO an XSL file? Any ideas? Ideally, I'd call it from a .asp file... :confused:
I have seen this done using xsl:param directly under the xsl:stylesheet declaration to pass in parameters, but I have only seen this work with command-line processors like Saxon, Xalan. Unfortunately, MSXML does not support top-level parameters. The workaround would be to append the data you want to pass through a parameter in the XML to be transformed and read it into a top-level variable.