Jump to content

Xpath Question: Stripping out query_id to set variable


shadowplay

Recommended Posts

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...