Subject: RE: [xsl] Converting embedded URLs int hot links via XSL From: Ghulam Abbas <abbasg_99@xxxxxxxxx> Date: Sat, 17 Apr 2004 13:42:06 -0700 (PDT) |
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"/><a href="<xsl:value-of select="concat($delim1,$emURL)"/>" target="_blank"><xsl:value-of select="concat($delim1, $emURL)"/></a>> <!-- #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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Converting embedded URLs , bryan . s . schnabel | Thread | RE: [xsl] Converting embedded URLs , Michael Kay |
RE: [xsl] use of the tags, Andreas L. Delmelle | Date | RE: [xsl] Converting embedded URLs , Michael Kay |
Month |