xsl-list
[Top] [All Lists]

RE: Extract attribute from markup returned by extension function

2005-08-03 13:49:28
Then I would do

<xsl:variable name="quot">"</xsl:variable>
<xsl:variable name="apos">'</xsl:variable>
<xsl:variable name="cue">src='</xsl:variable>
<xsl:variable name="v" select="translate($in, $quot, $apos)"/>
<xsl:variable name="w" select="translate($in, ' ', '')"/>
<xsl:value-of select="substring-before(substring-after($w, $cue), $apos)"/>

Michael Kay
http://www.saxonica.com/



-----Original Message-----
From: John [mailto:john-xsl-list(_at_)jpw3(_dot_)com] 
Sent: 03 August 2005 20:09
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Extract attribute from markup returned by 
extension function

Hello,

I am stuck with XSL 1.0.  I don't think I have to work with 
any wacky data.

Thanks & regards,

    -John

Michael Kay wrote:
(a) do you want an XSLT 1.0 or 2.0 solution?

(b) how robust must it be? Do you have to deal with 
pathological input such
as

<img alt='src="this/is/a/decoy"' src="this/is/real"/>

Michael Kay
http://www.saxonica.com/ 




-----Original Message-----
From: John [mailto:john-xsl-list(_at_)jpw3(_dot_)com] 
Sent: 03 August 2005 18:17
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Extract attribute from markup returned by 
extension function

Hello,

An XSL extension function returns markup such as <img 
src="/path/to/image.jpg" border="0" alt="" />.  I can't 
guarantee the / 
will be provided so it may not be XML markup.  I am only 
interested in 
the value of the src attribute.  I am hoping the code can be 
as flexible 
as possible (attributes could appear in any order, and it 
would be nice 
to support single quotes (') in addition to double-quotes 
(") in the 
data.  I was thinking of starting with the string 
functions, but I am 
curious if there might be a better way.

TIA,

   -John

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>