p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Classic ASP XML (http://p2p.wrox.com/forumdisplay.php?f=69)
-   -   escaping of characters in xsl:attribute (http://p2p.wrox.com/showthread.php?t=70425)

pramod September 5th, 2008 06:09 AM

escaping of characters in xsl:attribute
 
Hello!

I have a problem with escaping of characters when using xsl:attribute, this is an example of my xsl

<a href="/{../../@sFolder}/{../@sFolder}/{@sFolder}/" class="breadcrumb">

<xsl:attribute name="title" >

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

</xsl:attribute>

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

</a>

my xml document looks like this, with the value of document title already encoded. (if I dont escape the title I just get questionmarks for some characters like #260; and #321; when i print in outside an xsl:attribute)

<level4 nStructureID="661" nParentID="658" nRootID="1" nStructOrder="661" nStructLevel="4" nTemplateID="6" nSiteID="1" nContentID="667" sTitle="New Congenbill #26032;#30340;#24247;#37329;#25552;#21333;" sFolder="newcongenbill" nLanguageID="1" dtLiveDate="20080528" dtArchiveDate="20090528" dtDocDate="" dtDeleteDate="20100528" dtClosingDate="" />

this will produce the following html:

<a href="/shippingebrief/chineselanguageebrief/newcongenbill/" class="breadcrumb" title="New Congenbill &amp;#26032;&amp;#30340;&amp;#24247;&amp;#37329;&a mp;#25552;&amp;#21333;">New Congenbill #26032;#30340;#24247;#37329;#25552;#21333;</a>
but what I want is:

<a href="/shippingebrief/chineselanguageebrief/newcongenbill/" class="breadcrumb" title="New Congenbill #26032;#30340;#24247;#37329;#25552;#21333;">New Congenbill #26032;#30340;#24247;#37329;#25552;#21333;</a>

There is an extra text amp; appended to the tooltip.

When i print the text in the browser then it works fine but in the tooltip its creating a problem.

I am using ASP.

Is this a bug or the expected behaviour and if so, is there some workaround?

Thanks for your reply.

Thanks,
Pramod Bhagat

pramod September 12th, 2008 09:11 AM

Hi,

I have found a work around for this and this seems to be working.
This can be placed in the function which calls for translating the xslt.

sTranslate = Replace(sTranslate,"amp;","")

This will get rid of amp; which prevents chinese characters to display.

Regards,
Pramod



All times are GMT -4. The time now is 11:51 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.