xsl:character-map and xsl:attribute
Added by Anonymous almost 17 years ago
Legacy ID: #4645842 Legacy Poster: Konrad Windszus (kwin)
Unfortunately I couldn't get xsl:character-map and xsl:attribute to work. I want to embed SSI directives into an href attribute so that the following link should be created: <a href="/content/test.html<!--#echo var="testparam" -->">Testlink</a> I know that this isn't valid HTML but since the HTML is preprocessed by an SSI-mod in Apache valid HTML comes to the client. I found the following reference in the web: http://www.stylusstudio.com/xsllist/200505/post61420.html, but the proposed solution doesn't work for me. This is what I have written in the xsl: <xsl:character-map name="ssi-entities"> <!-- use this character for starting comment --> <xsl:output-character character="" string="<!--" /> <xsl:output-character character="" string="-->" /> <xsl:output-character character="" string=""" /> </xsl:character-map> <xsl:output method="html" media-type="text/html" encoding="UTF-8" indent="no" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" doctype-system="http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd" use-character-maps="ssi-entities" /> <xsl:template match="/"> <html> <body> <xsl:param name="href" select="concat('/content/test.html', '#echo var=test ')"/> <xsl:value-of select="$href" /> <!-- this does work well --> <a href="{$href}">testlink1</a> <!-- this doesn't work, the following comes out: /content/test.html%EE%80%80#echo var=%EE%80%82test%EE%80%82 %EE%80%81 --> <a> <xsl:attribute name="href" select="$href" /> <!-- this doesn't work either --> Testlink2 </a> </body> </html> How do I output some invalid attribute data within xsl:attribute. The attribute disable-output-escaping isn't available within this element and unfortunately xsl:character-map won't work either. Is there any other solution or have I done anything wrong? By the way I use Saxon 8.8. Thanks in advance Konrad
Replies (2)
RE: xsl:character-map and xsl:attribute - Added by Anonymous almost 17 years ago
Legacy ID: #4647169 Legacy Poster: Konrad Windszus (kwin)
I found the solution. XSLT2 introduces a new attributes escape-uri-attributes="no". As default this attribute is set to "yes" which results in URIs always being urlencoded. The effect from above is gone, if that attribute is set to "no" (see http://www.biglist.com/lists/xsl-list/archives/200405/msg00157.html).
RE: xsl:character-map and xsl:attribute - Added by Anonymous almost 17 years ago
Legacy ID: #4647542 Legacy Poster: Michael Kay (mhkay)
I think the rules changed later so that character maps would be applied after URI escaping. Check with the current Saxon release 9.0
Please register to reply