Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ampersand in link

Status
Not open for further replies.

hellohello1

Technical User
Jun 30, 2006
110
US
Hello,

I am trying to create a website link with an & in it.

This is the original link:

I have tried substituting & for the &
The XML compiles, but then the link doesn't go to the right page. Instead of showing section 372, the webpage goes to a 'this page has been moved' page.


I have tried substituting & for the &
and I get the same result.


Help!

Thanks,
 
Show a reduced script to demonstrate your problem.
 
Thanks for writing. If I use the below script, I can compile, but I'm not taken to the correct webpage. I'm taken to a 'this page has been moved' page.

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE instantiation PUBLIC 'instantiation.dtd' '<instantiation template='/Templates/Common/Reference Item Template' name='__Item__Reference_Definitions'>
<instance-list ref='Reference Item Definitions'>
<item template='Reference Items'>
<instance ref='referenceID'>
<value>BANK_362a</value>
</instance>
<instance ref='referenceName'>
<value>BC 362(a)</value>
</instance>
<instance ref='referenceURL'>
<value> </instance>
<instance ref='referenceVersionDate'>
<value>11-May-2005</value>
</instance>
</item>
 
Your xml is fine using &amp; in the value textnode. But by itself, it is not a hyperlink. So what do you mean by putting the link? Hyperlink in the sense of a html page? Or an xlink for xlink-aware application? This is the part you never show.

Here is a simple xsl to produce the html anchor to the target url. If the page really is moved, then it is moved---what can you do but moving it back or link to the new target url?
[tt]
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="<xsl:eek:utput method="html" encoding="utf-8" />
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates />
</body>
</html>
</xsl:template>
<xsl:template match="instantiation/instance-list/item/instance[@ref='referenceURL']">
<a href="{value}"><xsl:value-of select="value" /></a>
</xsl:template>
<xsl:template match="text()" />
</xsl:stylesheet>
[/tt]
 
thanks for writing.
I'm not sure i understand what you wrote.

The template i have to use is:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE instantiation PUBLIC 'instantiation.dtd' '<instantiation template='/Templates/Common/Reference Item Template' name='__Item__Reference_Definitions'>
<instance-list ref='Reference Item Definitions'>
<item template='Reference Items'>
<instance ref='referenceID'>
<value>BANK_362a</value>
</instance>
<instance ref='referenceName'>
<value>BC 362(a)</value>
</instance>
<instance ref='referenceURL'>
<value> </instance>
<instance ref='referenceVersionDate'>
<value>11-May-2005</value>
</instance>
</item>

When i try to compile i get an error because of the &.

If i change the & to &amp;, i am able to compile, but then
the link is misdirected because the &amp; is interpreted as literal characters.

Thanks,
 
>When i try to compile...
You must be so vested in your application that you think it is universal. What is the compiler? You just relist your xml file and it even is not complete in the sense of well-formed.
 
Hi,
Thanks for writing. Sorry for not being clearer.

I am using a 3rd party tool from a company called Fair Isaacs called Blaze 5.5.

Their template allows the ampersand in a literal string, but the Blaze 5.5 can't translate the &amp; into the proper & character.

Do you know any way around this?

Thanks,
 
have you tried using <![CDATA[]]>

This will cause the data to be output dirextly and not interpreted by the xml however so it may not work for your case. if using an xsl transform you can add something like this

<xsl:value-of select="value" disable-output-escaping="yes"/>

and the html should render properly

MCP, .Net Solutions Development <%_%>
 
First and foremost, you should ask Blaze guys. Otherwise, show what the template looks like. I cannot image they have any thing deeply proprietary to be so twisted on this renderment.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top