Click here to Skip to main content
15,888,968 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a very strange behavior when I got mutations in a node in xml when I try to parse it with an XSLT.

So we now assume that CustomerName has the Value 'MÖP'.

In this case, the resulting HTML 'a' tag would have a href to 'M%C3%B6P'
XML
<a href="{CustomerName}">
    <xsl:value-of disable-output-escaping="yes" select="CustomerName"/>
</a>

In this case, the resulting HTML 'div' tag would have an id 'MÖP'
XML
<div style="display:none">
    <xsl:attribute name="id"><xsl:value-of select="CustomerName"/></xsl:attribute>
</div>


It seems like the attribute href in the a tag has something to do with it.

My question is, why is it like that ? An what can i do that in both cases i got the same output ?

Greetz
Posted

1 solution

Somebody answered it in another forum. Here is the solution.

The XSLT processor is doing you a favour by escaping the URL value in the href attribute of the HTML link element. This is by design, see http://www.w3.org/TR/xslt-xquery-serialization/#HTML_ESCAPE-URI-ATTRIBUTES. If you really don't want that and you use an XSLT 2.0 processor then you can use
HTML
<xsl:ouput method="html" escape-uri-attributes="no" xmlns:xsl="#unknown" />
in your stylesheet.

The problem developing under .net is that it don't supports XSLT2.0.
You have to use a third party XSLTProcessor like Saxon.net
 
Share this answer
 
v2
Comments
[no name] 28-Dec-11 12:35pm    
Thanks for sharing the solution.
Regards

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900