Jump to content

Xpath Question: Stripping out query_id to set variable

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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...