shadowplay Posted January 15, 2013 Share Posted January 15, 2013 I've got a piece of code like this: <td class="tdSearch"><img class="tdSearchOptions" align="middle" title="Search Preferences"><a class="tdSearchOptions" href="if_pkg.edit_preferences?query_id=111111&page=2"><img class="tdSearchOptions" align="middle" title="Search Help"><a class="tdSearchOptions" href="http://url.com:9080/WebHelp/test.htm"></td> I need to strip out the query_id to use it as a variable in a piece of code like this: <xsl:variable name="qid" select="..." /> I'm still learning about Xpath, but I'm thinking I need to nest a substring-before inside a substring-after like this: substring-after('substring-before('/td[@class=tdSearch]/a[@class=tdSearchOptions]/@href','&')','=') The syntax doesn't look to be right and I'm not sure if this is the best way to go about it anyway, so comments are welcome. Also, will this also try to strip out anything in the second href? Xpath is pretty cool, but I still have a lot of learning to do! Thanks! Link to comment Share on other sites More sharing options...
Martin Honnen Posted January 19, 2013 Share Posted January 19, 2013 <xsl:variable name="qid" select="substring-before(substring-after(//td[@class = 'tdSearch']/a[@class = 'tdSearchOptions'][1], 'query_id='), '&')"/> might do. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now