[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Converting embedded URLs int hot links via XSL

Subject: RE: Converting embedded URLs int hot links via XSL
From: Ghulam Abbas <abbasg_99@xxxxxxxxx>
Date: Sat, 17 Apr 2004 13:42:06 -0700 (PDT)
xsl urls
Sorry about that. 
Here is what I"m doing

<xsl:template name="extract">
<xsl:param name="strEmbUrl"/>
<xsl:param name="delim1"/>
<xsl:param name="delim2"/>
		
<xsl:choose>
<xsl:when test="contains($strEmbUrl, $delim1)">
<xsl:variable name="strB4"
select="substring-before($strEmbUrl, $delim1)"/>
<xsl:variable name="strAfter"
select="substring-after($strEmbUrl, $delim1)"/>
<xsl:variable name="lastCh"
select="substring($strAfter,
string-length($strAfter))"/>
<xsl:choose>
<xsl:when test="$lastCh = $delim2">	
<xsl:choose>
<xsl:when test="contains($strAfter, $delim2)">
<xsl:variable name="emURL"
select="substring-before($strAfter, $delim2)"/>
<!-- #1 Solution -->
<xsl:value-of select="$strB4"/>&lt;a
href="<xsl:value-of select="concat($delim1,$emURL)"/>"
target="_blank"&gt;<xsl:value-of
select="concat($delim1, $emURL)"/>&lt;/a&gt;>
<!-- #2 Solution -->
<xsl:value-of select="$strB4"/><xsl:variable
name="link" select="concat($delim1,$emURL)"/>
<a target="_blank" href="{$link}">
<xsl:value-of select="$link"/></a>
<!-- #3 Solution -->
<xsl:value-of select="$strB4"/><xsl:element
name="A"><xsl:attribute name="href"><xsl:value-of
select="concat($delim1,$emURL)"/></xsl:attribute><xsl:attribute
name="target"><xsl:value-of
select="'_blank'"/></xsl:attribute><xsl:value-of
select="concat($delim1, $emURL)"/></xsl:element>
<!-- end problematic code -->

<xsl:call-template name="extract">
<xsl:with-param name="delim1" select="$delim1"/>
<xsl:with-param name="delim2" select="$delim2"/>
<xsl:with-param name="strEmbUrl"><xsl:value-of
select="substring-after($strEmbUrl,
$emURL)"/></xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$strEmbUrl"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$strEmbUrl"/>
</xsl:otherwise></xsl:choose></xsl:when>
<xsl:otherwise><xsl:value-of select="$strEmbUrl"/>
</xsl:otherwise></xsl:choose></xsl:template>

<xsl:template name="extractEmbeddedURLs">
<xsl:param name="str"/>
<xsl:call-template name="extract">
<xsl:with-param name="delim1" select="'http://'"/>
<xsl:with-param name="delim2">'</xsl:with-param>
<xsl:with-param name="strEmbUrl">
<xsl:call-template name="extract">
<xsl:with-param name="delim1" select="'http://'"/>
<xsl:with-param name="delim2">"</xsl:with-param>
<xsl:with-param name="strEmbUrl" select="$str"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:template>


Solution 1,2,3 are the problem area. I tried these 3
but first iteration works fine but when it goes into
the subsequent iteration string containing html is
lost somewhere. i.e. If I call extract only once then
it works fine and browser is able to render the html
but recursion seems to have some problem.

Ghulam Abbas

--- Michael Kay <mhk@xxxxxxxxx> wrote:
> > 
> > I've tried recursion but it doesn't work. Any
> ideas???
> > 
> 
> There is a bug in your code. How do you expect
> anyone to tell you where
> you've gone wrong if you don't show us your code?
> 
> It's necessary to show your code for two reasons:
> 
> (a) so people can tell you where your mistakes are
> 
> (b) so people can judge your level of experience and
> knowledge, and phrase
> their replies accordingly.
> 
> Michael Kay
> 



	
		
__________________________________
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25"
http://photos.yahoo.com/ph/print_splash

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.