Subject: RE: [xsl] XSL reading URL properties From: "Steve Gold" <Steve@xxxxxxxxxxxxx> Date: Thu, 12 Dec 2002 20:14:46 -0500 |
How about just a teeny touch of non XSL/XML??? Here is the only way I have been able to do this: Three documents: (1) your XML, (2) your XSL, and (3) an HTML document containing only the following: <SCRIPT> var xslt = new ActiveXObject("Msxml2.XSLTemplate"); var xslDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument"); var xslProc; xslDoc.async = false; xslDoc.resolveExternals = false; xslDoc.load("homepage_format.xsl"); xslt.stylesheet = xslDoc; var xmlDoc = new ActiveXObject("Msxml2.DOMDocument"); xmlDoc.async = false; xmlDoc.resolveExternals = false; xmlDoc.load("homepage_output.xml"); xslProc = xslt.createProcessor(); xslProc.input = xmlDoc; var temp = location.search; var temp_len = temp.length; xslProc.addParameter("unit_id", temp.substring(1,temp_len)); xslProc.transform(); document.write(xslProc.output); </SCRIPT> Call the HTML page like this: http://www.mypage.com/your.html?Smith Where "Smith" is the value you want to pass in. In the script shown above, you will change the XML and XSL file names and also change "unit_id" to a field name that works better for you. To read this, put the following at the top of your XSL: <?xml version="1.0" encoding="ISO-8859-1" ?> - <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:param name="unit_id" /> - <xsl:template match="PAGE"> - <html>........... Then when you want to use it, do something like: <xsl:for-each select="document($file_name)/PAGE/UNIT[UNIT_ID=$unit_id]"> And you will only get those rows from $file_name where UNIT_ID matches whatever is in the URL on the other side of the question mark. So the only non-XSL/XML code is in the HTML document. If there is another way, I'd love to know it too! Steve -----Original Message----- From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Jesse Ephraim Sent: Thursday, December 12, 2002 5:15 PM To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx Subject: [xsl] XSL reading URL properties I have an unusual situation at work, and am hoping that somebody can help me. I have an XML file with data about various items, and an XSL file that reads it and prints it out. Easy enough. I need to have the XSL file read the data sent from an HTML form (by Post, Get, or something similar) and display it. It would be okay to pass properties in the actual URL, too. For example, if an HTML page has a form that takes your last name, I need that to be displayed at the top of the XML/XSL page. Here's the catch... No Javascript, no ASP, no JAVA, no scripting language of any kind, no extra software loaded onto the server, etc. It all has to be contained within the XML and XSL files. (I didn't make these rules up - in this case I'm just following orders). Any suggestions would be helpful and greatly appreciated. - Jesse XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] XSL reading URL propertie, Michael Kay | Thread | Re: [xsl] XSL reading URL propertie, Mike Brown |
Re: [xsl] Problem on: Cascading xsl, alejandro david weil | Date | RE: [xsl] How to create hyperlinks , Mick Storm |
Month |