surina777 Posted November 2, 2010 Share Posted November 2, 2010 Hi, sorry wasn't sure where to put this since it deals with multiple sections of the forum...I want my xml data to display with a url like website.asp?id=1111 and if we query another id number the data changesI am aware query.string can do this, but i am not sure how to combine it all with xml and xslhere is my xml <?xml version="1.0" standalone="yes"?><brands> <row> <pb id="1111"></pb> <product_name>One-Piece</product_name> <spec_sheet>Specification Sheet</spec_sheet> </row> <row> <pb id="1114"></pb> <product_name>Two-Piece - 17</product_name> <spec_sheet>Specification Sheet</spec_sheet> </row></brands> the xsl... <?xml-stylesheet type="text/xsl" href="pb.xsl"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl:template name="hoo" match="/"> <html> <body> <xsl:for-each select="brands/row"> <xsl:call-template name="pbtemp"> <xsl:with-param name="param1" select="pb" /> <xsl:with-param name="param2" select="product_name" /> </xsl:call-template> </xsl:for-each> </body> </html></xsl:template><xsl:template name="pbtemp"> <xsl:param name="param1" select="'Not Available'" /> <xsl:param name="param2" select="'Not Available'" /> <div> <xsl:if test="@ID=$param1"> ID: <xsl:value-of select="$param1" /> PRODUCT NAME: <xsl:value-of select="$param2" /> <br /> </xsl:if> </div> </xsl:template></xsl:stylesheet> ASP.... <%Function transformXMLArguments(strXMLDoc, strXSLDoc, arrParams) Set xml = Server.CreateObject("MSXML2.FreeThreadedDOMDocument.3.0") xml.async = false xml.load strXMLDoc Set xsl = Server.CreateObject("MSXML2.FreeThreadedDOMDocument.3.0") xsl.async = false xsl.load strXSLDoc Set template = Server.CreateObject("MSXML2.XSLTemplate") template.stylesheet = xsl set processor = template.createProcessor() processor.input = xml if isarray(arrParams) then For i = 0 to UBound(arrParams) If arrParams(i) <> "" Then processor.addParameter "param" & (i+1), arrParams(i) else response.write "No records found" end if Nextend if processor.transform() transformXMLArguments = (processor.output) Set xml = nothing Set xsl = nothing Set template = nothing set processor = nothing End Function id = Request.QueryString("id")arrArgs = Array(id)response.write transformXMLArguments(Server.MapPath("test.xml"), Server.MapPath("pb.xsl"), arrArgs)%> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.