sherrynaeem2 Posted August 24, 2008 Share Posted August 24, 2008 Hi every one..hope someone repliesi have got this url http://localhost:4697/Copy%20of%20WebSite1/ItemData.aspx?1How do extract "1" at the end of the url so i use it in the following statement <xsl:for-each select="/ProductsDataSet/Mobiles[?????]">I aam displaying a xslt table so when i click on image 1 it goes to ItemData.aspx?1but instead of diplaying info for image 1 only it displays all or display nothing...i have tried some things...hope someone can figure it out.. Link to comment Share on other sites More sharing options...
Kahor Posted August 25, 2008 Share Posted August 25, 2008 select="substring-after(yourURL,'?') to extract the '1' at the end of the urlBasically it extracts everything in the content of tag yourURL after the character '?'Then put it in a parameter and call it in your select, or directly put it in the select.Can't help more than that cuz your message is a little bit unclear Link to comment Share on other sites More sharing options...
aalbetski Posted August 25, 2008 Share Posted August 25, 2008 If I'm guessing correctly, you're taking a parameter passed on the query string (or form, doesn't matter) and you need to pass that through to an XSLT stylesheet. At least that's what it looks like your doingIf I'm correct, then you need two steps, one in your ASP (or PHP) page to place the parameter into a variable and pass it to the XSLT. Next is to have the XSLT accept the value passed and then use the variable in your XPATH. Simple enough. I suggest using a named/value pair for the query string. If you have no control, using positioning.http://localhost:4697/Copy%20of%20WebSite1...aspx?category=1one var arg = decodeURI(Request.QueryString("category")) // get the value from the query stringvar objTransformer = new ActiveXObject("Msxml2.XSLTemplate.6.0")objTransformer.stylesheet = xslStyle.documentElementvar objProcessor = objTransformer.createProcessor()objProcessor.input = xmlSourceobjProcessor.addParameter("category",arg,"") <-- pass the arg to the stylesheetobjProcessor.transform() two <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:param name="category" /><xsl:for-each select="/ProductsDataSet/Mobiles[$category]"> This is not going to run by copying and pasting, but it should show you the steps needed.Hope it helps Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.