xsl-list
[Top] [All Lists]

RE: Converting embedded URLs int hot links via XSL

2004-04-19 13:50:05
I'm not going to start debugging this kind of regex for people. But the "$"
at the end, and the absense of any upper-case letters, look pretty dubious.

Michael Kay 

-----Original Message-----
From: Ragulf Pickaxe [mailto:jawxml(_at_)hotmail(_dot_)com] 
Sent: 19 April 2004 09:31
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Converting embedded URLs int hot links via XSL


tokenize seems about right, to find the preceding and 
following strings,
which may then be used in substring before and after to 
extract the needed
string.

but saxon 7.9.1 seems not to match using

<xsl:template match="/vs/url">
  <xsl:message>
  <xsl:for-each select="tokenize (.,
'(http|https|ftp)://((([a-z_0-9\-]+)+(([:]?)+([a-z_0-9\-]+))?
)(@+)?)?(((((([
0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5]))).(((([0-1])
?([0-9])?[0-9])
|(2[0-4][0-9])|(2[0-5][0-5]))).(((([0-1])?([0-9])?[0-9])|(2[0
-4][0-9])|(2[0-
5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0
-5]))))|((([a-z
0-9\-])+.)+([a-z]{2}.[a-z]{2}|[a-z]{2,4})))(([:])(([1-9]{1}[0
-9]{1,3})|([1-5
]{1}[0-9]{2,4})|(6[0-5]{2}[0-3][0-6])))?(/)?$')">
    <xsl:value-of select="."/><xsl:text>
    ========
</xsl:text>
  </xsl:for-each>
</xsl:message>

</xsl:template>

only printing out the full string.

Well, bug or should be used differently? Only M. Kay can tell.


I'm also curious how I might add (escape) the single or 
double quotes prior
to the
url in the example.
http://www.w3.org/TR/xmlschema-2/#nt-Punctuation seems not 
to include 
these?


Can't help you there - regular expressions par se gives no 
special meaning 
to single nor double quotes, so it is an issue in XSLT - and 
I expect you to 
be better at that, than me.


regards DaveP


Regards,
Ragulf Pickaxe :-)

_________________________________________________________________
Få alle de nye og sjove ikoner med MSN Messenger 
http://www.msn.dk/messenger


--+------------------------------------------------------------------
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>
--+--