p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   XSLT (http://p2p.wrox.com/forumdisplay.php?f=86)
-   -   Trouble Isolating Substring in Quotes (http://p2p.wrox.com/showthread.php?t=54238)

tclotworthy February 18th, 2007 07:14 PM

Trouble Isolating Substring in Quotes

I have a node attribute captured to a string analogous to:

="<a target="_top" href="..\external content\High Level Case.doc#high_case">High Case</a>"

from which I am attempting to isolate:

..\external content\High Level Case.doc#high_case

The pattern of the attributes are consistent (always start ="<a target="_top" href=" and always end </a>").

Any help here is greatly appreciated. Thanks

mhkay February 19th, 2007 04:31 AM

Something like this:

<xsl:variable name="quot">"</xsl:variable>
<xsl:variable name="hrefmarker"
  select="concat('href=', $quot)"/>
<xsl:variable name="s1" select="substring-after(@attribute, $hrefmarker)"/>
<xsl:variable name="s2" select="substring-before($s, $quot)"/>

Michael Kay
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference

All times are GMT -4. The time now is 07:47 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.