Bloody Viking
Usenet Archive
- Joined
- Dec 15, 2004
- Messages
- 8
- Reaction score
- 0
Namaste, Y'all!
I've got a problem I'm hoping one of you can solve. My stylesheet has the following bit of code:
<xsl:template match="web|WEB">
<xsl:variable name="url">
<xsl:value-of select='translate(.," 	

", "")'/> </xsl:variable> <a><xsl:attribute name="href"><xsl:if test="not(starts-with($url,'http'))">http://</xsl:if><xsl:value-of select="$url"/></xsl:attribute> <xsl:value-of select="$url"/> </a> </xsl:template>
Given the following XML:
<othinfo>
<italic>New York Times</italic>, (Available at <WEB
URL="http://www.mat.
jhu.edu/∼sormani/affirm-impact.html">http://www.mat.jhu.ed u/∼sormani/affirm-impact.html</WEB>)
</othinfo>
the resultant HTML is:
<em>New York Times</em>, (Available at <a
href="http://www.mat.jhu.edu/%E2%88%BC
sormani/affirm-impact.html">http://www.mat.jhu.edu/∼sormani/affirm-impact.ht ml</a>)
As you can see, ∼ is correctly translated to ∼ in the text part of the resultant <a> element, but is for some reason translated to %E2%88%BC in the href attribute. If I remove the translate function, and just have <xsl:variable name="url"><xsl:value-of select='.'/></xsl:variable> the result is identical.
- Paul Lieberman
I've got a problem I'm hoping one of you can solve. My stylesheet has the following bit of code:
<xsl:template match="web|WEB">
<xsl:variable name="url">
<xsl:value-of select='translate(.," 	

", "")'/> </xsl:variable> <a><xsl:attribute name="href"><xsl:if test="not(starts-with($url,'http'))">http://</xsl:if><xsl:value-of select="$url"/></xsl:attribute> <xsl:value-of select="$url"/> </a> </xsl:template>
Given the following XML:
<othinfo>
<italic>New York Times</italic>, (Available at <WEB
URL="http://www.mat.
jhu.edu/∼sormani/affirm-impact.html">http://www.mat.jhu.ed u/∼sormani/affirm-impact.html</WEB>)
</othinfo>
the resultant HTML is:
<em>New York Times</em>, (Available at <a
href="http://www.mat.jhu.edu/%E2%88%BC
sormani/affirm-impact.html">http://www.mat.jhu.edu/∼sormani/affirm-impact.ht ml</a>)
As you can see, ∼ is correctly translated to ∼ in the text part of the resultant <a> element, but is for some reason translated to %E2%88%BC in the href attribute. If I remove the translate function, and just have <xsl:variable name="url"><xsl:value-of select='.'/></xsl:variable> the result is identical.
- Paul Lieberman